nate
nate

Reputation: 139

'firebase deploy' Error - Must supply a public directory using "public" in each "hosting" config

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?

Upvotes: 8

Views: 4233

Answers (3)

Larry DaBig Meech
Larry DaBig Meech

Reputation: 164

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.

Upvotes: 0

TMob
TMob

Reputation: 1278

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

Upvotes: 10

kei
kei

Reputation: 78

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/**"
  ]
}

Upvotes: 4

Related Questions