firebase cli serve cant access the project from different device
firebase serve -o 0.0.0.0
The -o
flag sets the host.
For more information, see Server Fault: What's the difference between IP address 0.0.0.0 and 127.0.0.1?
If you run firebase serve --help
, it will give you the information needed to listen on a different port or IP address:
Usage: serve [options]
start a local server for your static assets
Options:
-p, --port <port> the port on which to listen (default: 5000) (default: 5000)
-o, --host <host> the host on which to listen (default: localhost) (default: localhost)
--only <targets> only serve specified targets (valid targets are: functions, hosting)
--except <targets> serve all except specified targets (valid targets are: functions, hosting)
-h, --help output usage information
You can use -p and -o on the command line to change the host and port where it listens for connections. For your case, you won't be able use localhost for the host because that's only visible to other processes on the same machine.