'Firebase Emulator UI requires a project ID to start

I have run through the docs and can not get the UI firebase emulator to work.

I'm using firebase version: 9.22.0 on a mac M1

warning in console.

i  emulators: Starting emulators: hosting
i  hosting: Serving hosting files from: build
✔  hosting: Local server: http://localhost:5001
⚠  emulators: The Emulator UI requires a project ID to start. Configure your default project with 'firebase use' or pass the --project flag.

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
└─────────────────────────────────────────────────────────────┘

┌──────────┬────────────────┐
│ Emulator │ Host:Port      │
├──────────┼────────────────┤
│ Hosting  │ localhost:5001 │
└──────────┴────────────────┘
  Emulator Hub running at localhost:4400
  Other reserved ports: None

I have tried using the --project myproject and it still does not work.

Firebase.json

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
  "emulators": {
    "hosting": {
      "port": 5001
    },
    "ui": {
      "enabled": true,
      "host": "localhost",
      "port": 4000
    }
  }
}

I've made sure my emulators are setup: firebase init emulators

Can anyone help this is driving me crazy.



Solution 1:[1]

I ran into this same issue. I don't exactly know what all steps it took to be resolved, as it took a few attempts to get it working for me. I ended up doing the following to resolve it

  • Update Firebase-Tools to latest version npm i -g firebase-tools (I was originally running v9.9.0)
  • Delete my firebase.json and .firebaserc files. Run firebase init again to set up the project
  • Run into an error when trying to start emulator documented here https://github.com/Automattic/cli-table/issues/153
  • Manually edit firebase-tools/package.json file and change the "cli-table": "https://github.com/phess101/cli-table.git" dependency.
  • Install globally installed firebase-tools dependencies using npm install
  • Run the emulator again

I submitted a pull request to the cli-table project, hopefully it can be reviewed and released soon. Looks like they just recently did a release and broke that portion of the firebase-tools code https://github.com/Automattic/cli-table/pull/154

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Phil Hess