4

I've been migrating to Firebase 3.0, and with the new changes, we have to use firebase serve on the CLI for local development, and I believe this defaults to port 5000. However, after going through the init process, running firebase serve doesn't do anything after "Starting Firebase development server..." even with specifying port 5000. Attempted fixes:

  • Tried with other ports, like 5001
  • Reinstalled Node (4.x and 6.x)
  • Reinstalled NPM
  • Removed firebase-cli (since firebase-tools is now being used)
  • Reinstalled firebase-tools with npm
  • Tweaked firebase init endlessly
  • Tried on different user accounts on my computer
  • Restarted computer
  • Checked that port 5000 was free by $lsof -i tcp:5000
  • Tested address variants like localhost:5000 and like 127.x and 192.x

Here is the debug log:

[debug] ----------------------------------------------------------------------
[debug] Command:      /usr/local/bin/node /usr/local/bin/firebase serve -p 5000 --debug
[debug] CLI Version:  3.0.0
[debug] Platform:     darwin
[debug] Node Version: v6.2.0
[debug] Time:         Sun May 22 2016 01:29:59 GMT+0200 (CEST)
[debug] ----------------------------------------------------------------------
[debug] 
[info] Starting Firebase development server...
[info] 
[info] Project Directory: /Users/user/Documents/localdev/spfwork

Any thoughts on how to fix?

Thank you for your help.

user3777933
  • 414
  • 1
  • 5
  • 17
  • This answer helped: https://stackoverflow.com/questions/48854370/firebase-serve-from-vagrant-localhost5000. Essentially, using flags -p 5000 -o helped. – raksheetbhat May 09 '21 at 13:41

3 Answers3

12

Fixed - firebase serve from firebase-tools (npm) was missing a logger for some errors, which I added on a pull request here: https://github.com/firebase/firebase-tools/pull/143

My error was that localhost was not starting for some reason, so I changed the command to firebase serve -p 5000 -o 127.0.0.1, and specifying the listen port allowed the server to start successfully.

For reference, the error was Error: getaddrinfo ENOTFOUND localhost

user3777933
  • 414
  • 1
  • 5
  • 17
2

You could just change your /etc/hosts file and use firebase serve normally.

To do this:

  1. Launch Terminal
  2. Type sudo nano /etc/hosts and press Return
  3. Enter your admin password Paste
  4. Paste

    ##
    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting. Do not change this entry.
    ##
    127.0.0.1       localhost
    255.255.255.255 broadcasthost
    ::1             localhost

  1. Save the file by pressing Ctrl + O
  2. Exit with Ctrl + X

This should fix it. See this for more

Umar Yusuf
  • 23
  • 3
0

If Firebase cannot find the 'Public' folder, this error might show up. In that case, the error can be resolved by putting index.html and other static files and app assets of the website within the public folder, and executing firebase deploy at the Firebase CLI again.

KuboAndTwoStrings
  • 864
  • 12
  • 20