Firebase serve error: Port 5000 is not open. Could not start functions emulator
Solution 1
For Mac/Linux, use the Terminal/Shell to find the Process ID (PID), then kill the process.
sudo lsof -i :5000
sudo kill -9 PID
Solution 2
In MacOS Monterey, port 5000 may be claimed by a new "AirPlay Receiver". This can be disabled in Settings -> Sharing:
Screenshot of settings panel for disabling AirPlay Receiver
Disabling the AirPlay Receiver (if you do not need it) frees up port 5000.
Solution 3
For Windows Users:
netstat -ano|findstr "PID :5000"
And then with the Process ID (PID) found at the end of the line.
taskkill /pid FOUNDPID /F
Command taskkill
does not work from within terminal of VS Code context. It needs an (elevated) CMD-prompt or equivalent Powershell environment in order to successfully terminate the listening on 127.0.0.1:5000.
Solution 4
Alternatively use a different port, it is a simple solution. For example, firebase serve -p 5001
Solution 5
The thing here is your port No 5000 is running with some process. So, first, you need to kill that process.
To find the Process id in ubuntu
sudo lsof -i :5000
Suppose PID you get 14541
To kill the Process
sudo kill -9 14541
Victor de Almeida
Updated on July 05, 2022Comments
-
Victor de Almeida almost 2 years
I'm trying to serve firebase functions locally, but when I run
firebase serve
orfirebase emulators:start
the error message is: "Port 5000 is not open, could not start functions emulator."I'm using Windows 10, so I've tried to change the port number, check if the port is blocked by Firewall and I create a new rule in Firewall to ports 5000-5010 but none of this approaches worked for me.