Firebase functions cannot deploy : SyntaxError: Unexpected token function

前端 未结 1 1297
长情又很酷
长情又很酷 2020-12-16 12:50

I am trying to deploy a function to firebase and I get an error during deployment

Error: Functions did not deploy properly.

Could it be linked with the async

1条回答
  •  独厮守ぢ
    2020-12-16 13:24

    As of September 2019:

    1. Update firebase-admin : npm install --save firebase-admin
    2. Update firebase-functions : npm install --save firebase-functions
    3. Add "engines": { "node": "10" } to your /functions/package.json
    ...
    "dependencies": {
        "firebase-admin": "^8.5.0",
        "firebase-functions": "^3.2.0"
      },
      "devDependencies": {
        "tslint": "~5.19.0",
        "typescript": "~3.6.2"
      },
      "engines": {
        "node": "10"
      }
    ...
    

    As of August 2018:

    Cloud Functions now support Node 8 (8.11.1). Check out this blog post.

    Upgrade to Node 8

    As suggested in this blog post, follow these steps to upgrade to Node 8:

    1. Upgrade your firebase-functions version via npm install --save firebase-functions@latest
    2. Upgrade firebase-tools via npm update -g firebase-tools
    3. Add "engines": { "node": "8" } to your /functions/package.json

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