我正在尝试部署我的 firebase 函数,但所有函数都返回错误,我之前已经部署过,没有任何错误。 自上次部署正确以来,我没有安装任何新东西。 每个函数都返回几乎相同的错误,唯一改变的是“errorId”
我尝试从 firebase-cli 注销并再次登录,我已经从 npm 更新了 firebase-tools、firebase-admin、firebase-functions。 我正在使用 firebase deploy --only 函数进行部署
部署错误。 构建失败:
{
"error": {
"canonicalCode": "INVALID_ARGUMENT",
"errorMessage": "`npm_install` had stderr output:\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/lodash-973f4ada/common/collection.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/node-29231f2f/inspector.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/node-f1c8db24/inspector.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@firebase/auth-1b85ce5b/dist/auth.esm.js.map'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@firebase/webchannel-wrapper-e6854ec7/dist/index.js'\nnpm ERR! code E404\nnpm ERR! 404 Not Found: grpc@1.20.1\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2019-06-08T18_16_17_266Z-debug.log\n\nerror: `npm_install` returned code: 1",
"errorType": "InternalError",
"errorId": "FD2536C1"
}
}
包.json :
{
"name": "functions",
"engines": {
"node": "8"
},
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"@firebase/storage": "^0.2.16",
"@google-cloud/vision": "^0.24.0",
"@sendgrid/mail": "^6.4.0",
"cors": "^2.8.5",
"dateformat": "^3.0.3",
"firebase": "^5.11.1",
"firebase-admin": "^7.4.0",
"firebase-functions": "^2.3.1",
"json2csv": "^4.5.1",
"mailchimp-api-v3": "^1.13.0",
"moment-timezone": "^0.5.25",
"openpay": "^1.0.3",
"paypal-rest-sdk": "^1.8.1",
"request": "^2.88.0"
},
"devDependencies": {
"eslint": "^4.12.0",
"eslint-plugin-promise": "^3.6.0",
"firebase-functions-test": "^0.1.6"
},
"private": true
}
正确部署函数。
更新*** 我试图删除所有内容并卸载除 firebase 函数所需的包之外的所有包,并从节点 8 中的一个测试函数重新开始我遇到了同样的问题,部署了节点 6,但我需要使用节点8 因为我需要使用 await/async
最佳答案
我有一个类似的部署失败。我认为这是由于我从 app
目录而不是 app\functions
目录运行 firebase deploy
引起的。在任何情况下,我从终端运行以下命令(在我的例子中使用 VSCode)已经切换到 app\functions
目录。然后部署工作完美。
npm install --save @google-cloud/storage
npm install --save firebase-admin@latest
npm install --save firebase-functions@latest
firebase deploy
希望对您有所帮助。
关于Firebase 函数无法部署,所有函数都出现相同的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56509118/