gpt4 book ai didi

google-cloud-functions - 错误 : Cannot find module '../lib/tslint-cli'

转载 作者:行者123 更新时间:2023-12-01 22:07:55 25 4
gpt4 key购买 nike

我正在尝试创建我的第一个 Firestore Cloud Function,并经历了 Get Started方向。但是当我尝试部署我的 Hello World 脚本时,出现以下错误:

=== Deploying to 'myproject-dev'...

i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint /Users/nlam/Dropbox/dev/myproject/backend/functions
> tslint --project tsconfig.json

module.js:549
throw err;
^

Error: Cannot find module '../lib/tslint-cli'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/nlam/Dropbox/dev/myproject/backend/functions/node_modules/.bin/tslint:3:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `tslint --project tsconfig.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nlam/.npm/_logs/2018-05-23T15_43_46_608Z-debug.log

Error: functions predeploy error: Command terminated with non-zero exit code1

我的功能很简单:

import * as functions from 'firebase-functions';

export const helloworld = functions.https.onRequest((request, response) => {
response.send("hello, world");
});

这是上面引用的日志的内容:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli '--prefix',
1 verbose cli '/Users/nlam/Dropbox/dev/myproject/backend/functions',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using npm@6.0.1
3 info using node@v8.11.1
4 verbose run-script [ 'prelint', 'lint', 'postlint' ]
5 info lifecycle functions@~prelint: functions@
6 info lifecycle functions@~lint: functions@
7 verbose lifecycle functions@~lint: unsafe-perm in lifecycle true
8 verbose lifecycle functions@~lint: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/nlam/Dropbox/dev/myproject/backend/functions/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle functions@~lint: CWD: /Users/nlam/Dropbox/dev/myproject/backend/functions
10 silly lifecycle functions@~lint: Args: [ '-c', 'tslint --project tsconfig.json' ]
11 silly lifecycle functions@~lint: Returned: code: 1 signal: null
12 info lifecycle functions@~lint: Failed to exec lint script
13 verbose stack Error: functions@ lint: `tslint --project tsconfig.json`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:283:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid functions@
15 verbose cwd /Users/nlam/Dropbox/dev/myproject/backend
16 verbose Darwin 17.5.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "--prefix" "/Users/nlam/Dropbox/dev/myproject/backend/functions" "run" "lint"
18 verbose node v8.11.1
19 verbose npm v6.0.1
20 error code ELIFECYCLE
21 error errno 1
22 error functions@ lint: `tslint --project tsconfig.json`
22 error Exit status 1
23 error Failed at the functions@ lint script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

我尝试通过以下方式安装 tslint:

sudo npm install -g tslint

但我仍然遇到同样的错误。

如有任何帮助,我们将不胜感激。提前致谢。

最佳答案

删除您的 node_modules 目录并重新安装您的节点包。

rm -rf node_modules
npm install

关于google-cloud-functions - 错误 : Cannot find module '../lib/tslint-cli' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50493083/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com