node.js - Firebase 部署云功能突然不起作用了

标签 node.js firebase google-cloud-functions

我很困惑。好久没出问题了,现在突然不能部署了。我不记得做过任何可能导致这种情况的事情。

我有 3 个不同的云函数。当我运行 firebase deploy 时,我得到了似乎每个错误都相同的错误:

!  functions[generateThumbs(europe-west1)]: Deployment error.
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`npm_install` had stderr output:\nnpm WARN tar ENOENT: no such file or directory, lstat '/workspace/node_modules/.staging/sharp-261f9e9e/docs/image'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/firebase-admin-a1197e24/lib/auth/token-verifier.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/lodash-973f4ada/common/math.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/sharp-261f9e9e/docs/index.md'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/lodash-973f4ada/common/number.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/lodash-973f4ada/common/object.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@google-cloud/storage-66ff4fa1/build/src/channel.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@google-cloud/storage-66ff4fa1/build/src/channel.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/express-5648fc3a/index.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@google-cloud/storage-66ff4fa1/build/src/file.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/express-5648fc3a/LICENSE'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/tar-253f970f/lib/update.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/express-5648fc3a/Readme.md'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/tar-253f970f/lib/warn-mixin.js'\nnpm WARN tar ENOENT: no such file
or directory, open '/workspace/node_modules/.staging/tar-253f970f/lib/winchars.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/tar-253f970f/lib/write-entry.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/xregexp-5f45e5d3/MIT-LICENSE.txt'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/ast-types-c8750e07/gen/namedTypes.js'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/ast-types-c8750e07/gen/nodes.d.ts'\nnpm ERR! code E404\nnpm ERR! 404 Not Found: websocket-driver@0.7.2\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /builder/home/.npm/_logs/2019-06-21T23_38_41_651Z-debug.log\n\nerror: `npm_install` returned code: 1", "errorType": "InternalError", "errorId": "1A98E1A1"}}

我用谷歌搜索,有人说要删除 package-lock.json,所以我就这么做了。我运行了 npm install,它给了我这些警告:

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Jesper\intergun\functions\node_modules\concat-stream\node_modules\isarray\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Jesper\intergun\functions\node_modules\firebase-functions\node_modules\ms\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Jesper\intergun\functions\node_modules\through2\node_modules\isarray\package.json'

然后我尝试了 firebase deploy --only functions,每个云函数都出现了这个错误:

!  functions[generateThumbs(europe-west1)]: Deployment error.
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`npm_install` had stderr output:\nnpm ERR! Cannot read property 'match' of undefined\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /builder/home/.npm/_logs/2019-06-21T23_51_11_275Z-debug.log\n\nerror: `npm_install` returned code: 1", "errorType": "InternalError", "errorId": "70391B03"}}

为什么会突然发生这种情况,我该如何解决?请帮忙。

最佳答案

错误消息说您的 node_modules 文件夹中缺少一些东西。删除整个 node_modules 文件夹,然后再次 npm install。

关于node.js - Firebase 部署云功能突然不起作用了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56711573/

相关文章:

node.js - AWS CI/CD 工作流程的最佳路径是什么? Cloudformation、SAM 还是无服务器框架?

java - 发布的图片未出现在 Firebase Recycler View 中

javascript - 第一行完成后如何开始下一行?

node.js - 使用 mongoose 保存未显示在 mongodb 中的数据

swift - 从数据库中获取特定数据并打印

node.js - 在 firebase 中看不到请求 header 的值?

javascript - 我正在尝试实现一个dialogflow webook来连接到wordpress api,但收到错误: No responses defined for platform: null

javascript - 如何从代码中查找是否在本地运行的Firebase函数

javascript - 如何检测使用 Node.js 连接的 USB 设备

firebase - Flutter Web 应用程序在部署到 Firebase 托管后返回空白页面