Reputation: 151
I am trying to add Hosting to an existing firebase app that has Functions up and running. I intended to host a react app that consume my existing functions. The public directory I chose for hosting is /{react-project-root-folder}/build.
I followed this answer to add hosting.
When I am running firebase deploy
, it gives the error
Error: Specified "public" directory "/view/build" does not exist, can't deploy hosting to site {app-name}
Even though the folder exists.
Can you help me spot what I did wrong? Should I choose another folder?
My folder structure:
Firebase Practice
|__ functions
|__ .firebase.json
|__ .firebaserc
|__ view
|__ build
|__ static/js
|__ index.html
|__ node_modules
|__ public
|__ src
Image of folder structure:
firebase.json:
{
"functions": {
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log"
],
"source": "functions"
},
"hosting": {
"public": "/view/build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "/api/*",
"function": "api"
},
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Upvotes: 0
Views: 1300
Reputation: 151
Turn out you do not need the first /
on your public path.
Corrected firebase.json:
{
"functions": {
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log"
],
"source": "functions"
},
"hosting": {
"public": "view/build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Upvotes: 1