Ошибка: не удается найти модуль '../lib/tslint-cli' - PullRequest
0 голосов
/ 23 мая 2018

Я пытаюсь создать свою первую облачную функцию Firestore и прошел указания 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

, но все еще получал ту же ошибку.

Любая помощь будет оценена.Заранее спасибо.

1 Ответ

0 голосов
/ 24 августа 2018

Можете ли вы попытаться ввести приведенный ниже код для своего терминала?

tslint --project tsconfig.json

, если он показывает

no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.

Затем удалите "no-unused-variable": {"severity": "warning"}, из файла tslint.json в папке функций.

если он показывает что-то еще, не могли бы вы опубликовать здесь ошибку, чтобы мы могли взглянуть?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...