Firebase-tools: "Error: Port 5000 is not open, could not start functions emulator" when `npm run serve`

Created on 18 Aug 2019  路  7Comments  路  Source: firebase/firebase-tools

[REQUIRED] Environment info


node: 12.8.0
npm: 6.10.3


firebase-tools: 7.2.2


Platform: macOS

[REQUIRED] Test case


look step below

[REQUIRED] Steps to reproduce


run npm run serve command

[REQUIRED] Expected behavior


Run simulator cloud functions successfully

[REQUIRED] Actual behavior

[2019-08-18T02:34:58.696Z] ----------------------------------------------------------------------
[2019-08-18T02:34:58.704Z] Command:       /usr/local/Cellar/node/12.8.0/bin/node /usr/local/bin/firebase serve --only functions --debug
[2019-08-18T02:34:58.706Z] CLI Version:   7.2.2
[2019-08-18T02:34:58.706Z] Platform:      darwin
[2019-08-18T02:34:58.706Z] Node Version:  v12.8.0
[2019-08-18T02:34:58.707Z] Time:          Sun Aug 18 2019 09:34:58 GMT+0700 (Indochina Time)
[2019-08-18T02:34:58.707Z] ----------------------------------------------------------------------

[2019-08-18T02:34:58.714Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-08-18T02:34:58.715Z] > authorizing via signed-in user
[2019-08-18T02:34:58.715Z] [iam] checking project jrt-shop-fc0f1 for permissions ["firebase.projects.get"]
[2019-08-18T02:34:58.717Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/jrt-shop-fc0f1:testIamPermissions
 permissions=[firebase.projects.get]
[2019-08-18T02:35:00.198Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sun, 18 Aug 2019 02:35:02 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=1140, alt-svc=quic=":443"; ma=2592000; v="46,43,39", accept-ranges=none, transfer-encoding=chunked
[2019-08-18T02:35:00.207Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/jrt-shop-fc0f1

[2019-08-18T02:35:00.720Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sun, 18 Aug 2019 02:35:03 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43,39", accept-ranges=none, transfer-encoding=chunked

Error: Port 5000 is not open, could not start functions emulator.

Most helpful comment

this is fixed in [email protected]

All 7 comments

One line fix on OSX:

sed -i '' 's/stopPort: port/stopPort: port+1/' node_modules/firebase-tools/lib/emulator/controller.js

this is fixed in [email protected]

@piscis I just installed [email protected] yesterday and this error still occurred. I ran the one line fix above and the emulator started up.

@gilcreque maybe you could give [email protected] also have a look at #1606 this is where the issue is tracked.

does command +c stop the emulator? it takes me back to terminal but then I can't seem to call my functions anymore. I try to restart the emulator but then it gives me the error, port 5000 not open. How do I get back to the shell or call functions from terminal after I exit the emulator shell with command + c?

@LouieSankey if that is a reproducible behavior, could you please open a new Issue for that? If we're still holding on to ports, that wouldn't be great...

Was this page helpful?
0 / 5 - 0 ratings