8

I am receiving the error 'Must supply a public directory using "public" in each "hosting" config.' when deploying my firebase app. How do I fix this?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
nate
  • 139
  • 2
  • 9
  • Please edit the question to show your configuration. I suggest also pointing out what's different with it than the default configuration provided by the CLI when your project was initialized. – Doug Stevenson Apr 15 '20 at 21:23

3 Answers3

10

I was using "public: "" to deploy the root directory. When it forced me to use a value I instead passed "public": "." which worked.

TMob
  • 1,278
  • 1
  • 13
  • 33
4

Got the same error and fixed it with adding "public" to firebase.json in the empty "public" attribute.

Your firebase.json should be like this.

"hosting": {
  "public": "public", // <- Added
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**"
  ]
}
kei
  • 78
  • 6
0

So this basically means you need to specify your public folder which is the folder that contains the index file "destination" of your 'static files' folder '(build)' or as you may call it the root folder of your project.

if '/' is used instead of '/public' then this means if you /cd into public from your terminal - 'the folder that contains the index file' - the destination as specified in the firebase.JSON file, then the inside of the of the 'public' folder will be where your firebase file is initialised.