【发布时间】:2020-08-02 05:14:45
【问题描述】:
背景:我最近(尝试)将 Taiko 添加到我的 Firebase 网络应用中。 Taiko 是一个浏览器自动化的 npm 包,类似于 Puppeteer。也许相关:它下载 Chromium 来工作。
问题:现在没有我的功能将部署。
问题除了解决这个特定问题之外,我更普遍的问题是,“我在这个工作流程中缺少什么?” / "以后如何避免这个问题?"
错误消息:(我的粗体,突出显示可能相关的内容)
- 构建失败: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`npm_install` 有标准错误输出:\n/workspace/node_modules/fs-extra/lib/mkdirs /make-dir.js:86\n } catch {\n ^\n\nSyntaxError: Unexpected token {\n at createScript (vm.js:80:10)\n at Object.runInThisContext (vm.js:139:10)\n 在 Module._compile (module.js:617:28)\n 在 Object.Module._extensions..js (module.js:664:10)\n 在 Module.load (module.js:566:32)\n 在 tryModuleLoad (module.js:506:12)\n 在 Function.Module._load (module.js:498:3)\n 在 Module.require (module.js: 597:17)\n 在要求 (internal/module.js:11:18)\n 在 Object. (/workspace/node_modules/fs-extra/lib/mkdirs/index.js:3:44)\nnpm 错误! code ELIFECYCLE\nnpm ERR!errno 1\nnpm ERR!taiko@1.0.7 install: `node lib/install.js`\nnpm ERR! Exit status 1\nnpm ERR!\nnpm ERR!在taiko@失败1.0.7 安装脚本。\nnpm ERR!这可能不是 npm 的问题。Th上面可能有额外的日志输出。\n\nnpm ERR!可以在以下位置找到此运行的完整日志:\nnpm ERR! /builder/home/.npm/_logs/2020-04-19T14_36_20_217Z-debug.log\n\n错误:`npm_install`返回代码:1","errorType":"InternalError","errorId":"02C3A7B5"}}
package.json
{
"name": "functions",
"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"
},
"engines": {
"node": "8"
},
"dependencies": {
"firebase-admin": "^8.10.0",
"firebase-functions": "^3.3.0",
"node-fetch": "^2.6.0",
"stripe": "^7.14.0",
"taiko": "^1.0.6",
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-plugin-promise": "^4.0.1",
"firebase-functions-test": "^0.1.6"
},
"private": true
}
到目前为止我做了什么:
在
index.js、requireing Taiko 中创建了 Taiko 测试功能。将太鼓添加到
package.json在函数文件夹中运行
npm install收到消息
npm WARN ws@7.2.3 requires a peer of bufferutil@^4.0.1 but none is installed. npm WARN ws@7.2.3 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.接下来,
npm installed 以上两个包都在/functions中
这与我在index.js 中创建Stripe 函数所遵循的基本过程相同,并且没有任何问题。
编辑:Taiko 1.07、Node 12.16.2、npm 6.9.0、firebase-tools cli 8.1.1
感谢任何见解!
【问题讨论】:
标签: javascript node.js firebase npm google-cloud-functions