“An unexpected error has occurred” after firebase deploy

自闭症网瘾萝莉.ら 提交于 2019-12-01 17:27:25

For me updating firebase-tools solved the issue

run below command in your cmd prompt

npm install -g firebase-tools

then try firebase init again

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

Copy this and paste inside of 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"
        } ]
      }]
    }
  }

In my case, resolve with:

firebase deploy --except functions

Yes I've faced this issue.. This is because of my node version I was using Node v.8.0.0 I just downgrade it to Node v.16.0.3 and then my deployment done :)

It could be due to npm and node version For mac os, you can update npm using command:

npm install -g npm@latest

and update node directly by going to link https://nodejs.org/en/ and download installer. and run

npm install -g firebase-tools

For removing firebase hosting deployment errors (also if you are updating existing hosted site) you can do process again 1] firebase login 2] firebase init 3] firebase deploy

Make sure your current folder has two things: public folder (which contains all files index.html) And firebase.json file

I get that error when I haven't run npm install. Try it out. I hope that simple solution helps anyone with the same problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!