firebase / friendlyeats-web

Apache License 2.0
437 stars 393 forks source link

firebase emulator not working #226

Open riceball1 opened 1 year ago

riceball1 commented 1 year ago

I attempted to follow this step here but when I ran the command firebase emulators:start --only hosting it would gave me the following error Error: Could not start Hosting Emulator, port taken.

firebase emulators:start --only hosting
i  emulators: Starting emulators: hosting
i  emulators: Shutting down emulators.
i  hub: Stopping emulator hub
⚠  hosting: Port 5000 is not open on localhost, could not start Hosting Emulator.
⚠  hosting: To select a different host/port, specify that host/port in a firebase.json config file:
      {
        // ...
        "emulators": {
          "hosting": {
            "host": "HOST",
            "port": "PORT"
          }
        }
      }
i  emulators: Shutting down emulators.

Error: Could not start Hosting Emulator, port taken.

I think a fix is to add the following in firebase.json file, though wonder if there's a way to use dynamic open port variables instead of hardcoding ones:

"emulators": {
      "firestore": {
        "port": 5002
      },
      "functions": {
        "port": 5001
      },
      "hosting": {
        "port": 5005
      }
    },