When I am hosting my web page through firebase hosting then after writing command firebase deploy
I got the following error:
Microsoft Windows [Versi
Close the integrated terminal of your IDE by typing exit and hit enter, then re-open it and give the command firebase deploy
If the above option does not work then just use terminal in linux/mac and CMD in windows and navigate to the folder then give firebase deploy
command
Below code fixed my issue.
Add below code into firebase.json.
{
"hosting": {
"public": "./",
"ignore": [
"firebase.json",
"database-rules.json",
"storage.rules",
"functions"
],
"headers": [{
"source" : "**/*.@(js|html)",
"headers" : [ {
"key" : "Cache-Control",
"value" : "max-age=0"
} ]
}]
}
}
First of all, looking into firebase-debug.log
in the root of your project (next to firebase.json) might help to define the error. In my case there was "Cannot read property 'deploys' of undefined" error. There's an associated issue on github. Removing extra sites (I didn't actually need them) and leaving only the default one in the Firebase hosting dashboard solved my problem.
For me, it is because I run firebase deploy
inside functions
folder. I need to run it in the parent firebase
directory
To solve this problem without restart,
firebase deploy --only functions
firebase --serve
In your firebase.json file, do you have a value set for functions or functions.source? If you do, that may be causing this issue. Remove the functions in angular.json it will work
Firebase document for functions