I'm trying to serve firebase functions locally, but when I run firebase serve
or firebase 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.
This error is because of the failed quitting from firebase emulator. You already have the process of previous firebase emulator. For a new start, you have to find and stop the previous process.
Double tap CTRL-C (hold down CTRL and double tap C) in the terminal running the emulator when you want to shut down the emulator and clear all the ports and processes.
The Firebase Local Emulator Suite consists of individual service emulators built to accurately mimic the behavior of Firebase services. This means you can connect your app directly to these emulators to perform integration testing or QA without touching production data.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With