Search code examples
localhostfirebase-hostingfirebase-tools

firebase serve, emulator port for hosting?


I just added new Firebase project with the following in firebase.json:

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

I started it with firebase serve. And it serves hosting on port 5000 (instead of 5002):

+  hosting: Local server: http://localhost:5000

Am I doing something wrong?


Solution

  • firebase.json file doesn't work with the the firebase serve command. You have to use the firebase emulators:start command.

    If you want to keep using firebase serve then it should be use like in:

    firebase serve --only hosting --port=5002