Firebase Serve Error

Vince picture Vince · Jun 11, 2017 · Viewed 7.1k times · Source

I am new to firebase and am trying to make a simple app that utilizes user authentication. At this point in the project I am trying to run firebase on a local server using CLI commands.
I have set up firebase init and firebase deploy. When I type firebase serve on my project folder i get the response,

"an unexpected error has occurred".

Below i am attaching the contents of my firebase-debug.log file. Any help would be appreciated. Thanks

command requires scopes:

["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase",... [debug] [2017-06-11T17:09:09.607Z] > authorizing via signed-in user

TypeError: Cannot read property 'public' of undefined

Answer

davidvgalbraith picture davidvgalbraith · Jun 22, 2017

Look in your firebase.json file, which you should have in the directory where you're running firebase serve. It should look something like this:

{
  "hosting": {
    "public": "app",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

If it doesn't have that "hosting" key, then you'll get that Cannot read property 'public' of undefined error because firebase serve tries to access .hosting.public.