Firebase serve not working
Solution 1
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
Solution 2
You could just change your /etc/hosts
file and use firebase serve
normally.
To do this:
- Launch Terminal
- Type
sudo nano /etc/hosts
and press Return - Enter your admin password Paste
- 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
- Save the file by pressing Ctrl + O
- Exit with Ctrl + X
This should fix it. See this for more
Related videos on Youtube
user3777933
Updated on June 04, 2022Comments
-
user3777933 almost 2 years
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, runningfirebase 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.