“An unexpected error has occurred” after firebase deploy

前端 未结 14 1146
无人及你
无人及你 2020-12-20 14:53

When I am hosting my web page through firebase hosting then after writing command firebase deploy I got the following error:

Microsoft Windows [Versi         


        
相关标签:
14条回答
  • 2020-12-20 15:29

    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

    0 讨论(0)
  • 2020-12-20 15:30

    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"
              } ]
            }]
          }
        }
      
    0 讨论(0)
  • 2020-12-20 15:34

    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.

    0 讨论(0)
  • 2020-12-20 15:34

    For me, it is because I run firebase deploy inside functions folder. I need to run it in the parent firebase directory

    0 讨论(0)
  • 2020-12-20 15:36

    To solve this problem without restart,

    1. You have to make sure you shut down the server, by click on CTRL + C
    2. Then deploy your functions by firebase deploy --only functions
    3. Then run it again firebase --serve
    0 讨论(0)
  • 2020-12-20 15:39

    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

    0 讨论(0)
提交回复
热议问题