Error: Could not start Database Emulator, port taken.

See original GitHub issue

First question: I can not setup new Emulators port and project. I can not open other staff like real time database. That means the “firebase emulators:start” command not work for me.

i  emulators: Starting emulators: auth, functions, firestore, database, hosting, pubsub
!  functions: The functions emulator is configured but there is no functions source directory. Have you run firebase init functions?
!  firestore: Did not find a Cloud Firestore rules file specified in a firebase.json config file.
!  firestore: The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
i  firestore: Firestore Emulator logging to firestore-debug.log
i  emulators: Shutting down emulators.
i  firestore: Stopping Firestore Emulator
!  Firestore Emulator has exited upon receiving signal: SIGINT
i  hub: Stopping emulator hub
!  database: Port 9000 is not open on localhost, could not start Database Emulator.
!  database: To select a different host/port, specify that host/port in a firebase.json config file:
      {
        // ...
        "emulators": {
          "database": {
            "host": "HOST",
            "port": "PORT"
          }
        }
      }
i  emulators: Shutting down emulators.

Error: Could not start Database Emulator, port taken.

Second question: I can not setup new emulator. What should I do? I always get following results for command “firebase init”

=== Emulators Setup
? Which Firebase emulators do you want to set up? Press Space to select emulators, then Enter to confirm your choices. (Press <space> to select, <a> to toggle all, <i> to i
nvert selection)Authentication Emulator, Functions Emulator, Firestore Emulator, Database Emulator, Hosting Emulator, Pub/Sub Emulator
i  Port for auth already configured: 9099
i  Port for functions already configured: 5001
i  Port for firestore already configured: 8080
i  Port for database already configured: 9000
i  Port for hosting already configured: 5000
i  Port for pubsub already configured: 8085
i  Emulator UI already enabled with port: (automatic)
? Would you like to download the emulators now? No

Issue Analytics

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

github_iconTop GitHub Comments

40reactions
nico75005commented, Nov 29, 2020

Assuming you use a shell like bash for example, just do

lsof -ti tcp:9000 | xargs kill -9

You port might be used due to a previous stop of the emulator in a wrong way.

7reactions
MalikOwais123commented, Mar 29, 2021

I use https://www.npmjs.com/package/kill-port before starting the emulator ; works like a charm

Thanks…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase serve error: Port 5000 is not open. Could not start ...
The thing here is your port No 5000 is running with some process. So, first, you need to kill that process. To find...
Read more >
Port 8080 is not open on localhost, could not start Firestore ...
This error is because of the failed quitting from firebase emulator. You already have the process of previous firebase emulator.
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 >
Install, configure and integrate Local Emulator Suite - Firebase
If you don't configure these settings, the emulators will listen on their default ports, and the Cloud Firestore, Realtime Database and Cloud Storage...
Read more >
Could not start Functions Emulator, port taken Code Example
Queries related to “Could not start Functions Emulator, port taken” · Port 5000 is not open on localhost, could not start functions emulator....
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