question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

firebase functions:shell - Port 5000 is not open, could not start functions emulator

See original GitHub issue

[REQUIRED] Environment info

firebase-tools: 7.2.2

Platform: macOS

[REQUIRED] Test case

firebase functions:shell

[REQUIRED] Steps to reproduce

  1. $ npm install -g firebase-tools
  2. $ npm install firebase-functions@latest firebase-admin@latest --save
  3. firebase functions:shell

[REQUIRED] Expected behavior

firebase shell runs as advertised

[REQUIRED] Actual behavior

CLI Output: Port 5000 is not open, could not start functions emulator. firebase-debug.log

[debug] [2019-08-18T03:02:45.322Z] ----------------------------------------------------------------------
[debug] [2019-08-18T03:02:45.324Z] Command:       /usr/local/bin/node /usr/local/bin/firebase functions:shell
[debug] [2019-08-18T03:02:45.324Z] CLI Version:   7.2.2
[debug] [2019-08-18T03:02:45.324Z] Platform:      darwin
[debug] [2019-08-18T03:02:45.324Z] Node Version:  v10.15.3
[debug] [2019-08-18T03:02:45.330Z] Time:          Sat Aug 17 2019 23:02:45 GMT-0400 (Eastern Daylight Time)
[debug] [2019-08-18T03:02:45.330Z] ----------------------------------------------------------------------
[debug] 
[2019-08-18T03:04:19.141Z] > 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-18T03:04:19.141Z] > authorizing via signed-in user
[2019-08-18T03:04:19.142Z] [iam] checking project ddme-329f1 for permissions ["firebase.projects.get"]
[2019-08-18T03:04:19.143Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/ddme-329f1:testIamPermissions
 permissions=[firebase.projects.get]
[2019-08-18T03:04:24.132Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sun, 18 Aug 2019 03:04:23 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=111, 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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:16
  • Comments:24 (3 by maintainers)

github_iconTop GitHub Comments

17reactions
Jank1310commented, Aug 18, 2019

Seems to be related to the new portfinder release. https://github.com/http-party/node-portfinder/issues/84

The code used by the emulator fails with the latest version (1.0.22):

await pf.getPortPromise({ port, stopPort: port });

A workaround could be (besides using the old 1.0.21 version) :

await pf.getPortPromise({ port, stopPort: port + 1 });

QuickFix Edit the file firebase-tools/lib/emulator/controller.js in node_modules and change yield pf.getPortPromise({ port, stopPort: port }) to yield pf.getPortPromise({ port, stopPort: port + 1 })

There is an open pull request which fixes this “bug”: https://github.com/http-party/node-portfinder/pull/86

9reactions
micksatanacommented, Aug 19, 2019

In case someone want to find global node_modules to apply the quick fix. you can run npm root -g to see where your global node_modules are.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase serve error: Port 5000 is not open. Could not start ...
first, close all tab restart VS code then just go in firebase.json file then change ui port ...
Read more >
[Solved] Port 5000 is not open, could not start functions emulator
Firebase is a backend platform to build web, mobile apps. If you get the following error message "Port 5000 is not open, could...
Read more >
Javascript – Firebase serve error: Port 5000 is not open. Could ...
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...
Read more >
how do u solve this error in firebase "Port 5000 is not open ...
how do u solve this error in firebase "Port 5000 is not open on localhost, could not start functions emulator.".
Read more >
Could not start Functions Emulator, port taken Code Example
Port 5000 is not open on localhost, could not start functions emulator. shell by Strange ... More “Kinda” Related Answers View All Shell/Bash...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found