我正在尝试部署我的firebase函数,但是所有的函数都返回错误,我之前已经部署好了,没有任何错误。自从上一次部署正确之后,我没有安装任何新的东西。每个函数返回几乎相同的错误,唯一不同的是"errorId“
我已经尝试从firebase-cli注销并重新登录,我已经从npm更新了firebase-tools,firebase-admin,firebase-function。我正在使用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"
}
}Package.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
发布于 2019-06-21 18:06:27
我也遇到过类似的部署失败。我认为这是由于我从app目录而不是app\functions目录运行firebase deploy造成的。在任何情况下,我都是从切换到app\functions目录的终端(在我的例子中使用VSCode )运行以下命令。然后部署就完美地工作了。
npm install --save @google-cloud/storage
npm install --save firebase-admin@latest
npm install --save firebase-functions@latest
firebase deploy希望这能有所帮助。
发布于 2021-07-06 23:24:10
检查日志
您可以使用以下命令打开日志来检查实际日志
firebase functions:log这样做真的很有帮助,因为特定的问题通常会在那里可见。我有时甚至会遇到像package.json中缺少包名这样简单的错误
如果firebase可以直接显示更好的错误信息,那将会非常有帮助。但至少我们可以在这里找到他们。
我希望它能帮上忙
发布于 2021-01-01 22:26:25
我也遇到过类似的问题,结果是我的package.json中缺少一个模块
您可以在此处查看更详细/有用的日志:https://console.cloud.google.com/logs
https://stackoverflow.com/questions/56509118
复制相似问题