Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Serve Error

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

like image 933
Vince Avatar asked Jun 11 '17 17:06

Vince


2 Answers

I faced this issue today, I ran it with --debug and found out that I've installed npm/node as sudo user, running following:

firebase serve

was giving me this error:

Error: An unexpected error has occurred.

When I ran it with sudo, I was able to deploy hosting and functions locally:

sudo firebase serve --debug --only hosting,functions
like image 167
thekosmix Avatar answered Oct 20 '22 08:10

thekosmix


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.

like image 11
davidvgalbraith Avatar answered Oct 20 '22 08:10

davidvgalbraith