如何在NodeJS(运行npm脚本)中查找生成错误的原因?

时间:2018-08-30 23:50:10

标签: node.js npm-scripts

当我按如下方式运行npm脚本时,会收到以下CLI消息。但是,我找不到确切的根本原因吗?

PS C:\RepoNAA\rtc-quickconnect> npm run test3
> rtc-quickconnect@5.9.0 test3 C:\RepoNAA\rtc-quickconnect
> browserify test/all.js | broth start

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: spawn start ENOENT
    at _errnoException (util.js:992:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rtc-quickconnect@5.9.0 test3: `browserify test/all.js | broth start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rtc-quickconnect@5.9.0 test3 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!     C:\Users\Xin\AppData\Roaming\npm-cache\_logs\2018-08-30T23_46_31_387Z-debug.log
PS C:\RepoNAA\rtc-quickconnect>

即使完整的日志也没有显示确切的错误原因:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Xin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'test3' ]
2 info using npm@6.4.0
3 info using node@v8.11.4
4 verbose run-script [ 'pretest3', 'test3', 'posttest3' ]
5 info lifecycle rtc-quickconnect@5.9.0~pretest3: rtc-quickconnect@5.9.0
6 info lifecycle rtc-quickconnect@5.9.0~test3: rtc-quickconnect@5.9.0
7 verbose lifecycle rtc-quickconnect@5.9.0~test3: unsafe-perm in lifecycle true
8 verbose lifecycle rtc-quickconnect@5.9.0~test3: PATH: C:\Users\Xin\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\RepoNAA\rtc-quickconnect\node_modules\.bin;C:\Users\Xin\.windows-build-tools\python27\;C:\Users\Xin\.windows-build-tools\python27\Scripts;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\OpenSSL-Win32\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\dotnet\;C:\Program Files\Amazon\AWSCLI\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files\erl9.1\bin;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\MSBuild\14.0\Bin;C:\Program Files (x86)\Windows Kits\8.1\Include\winrt;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft VS Code Insiders\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\nodejs\;C:\Users\Xin\.dnx\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Python27;C:\Users\Xin\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code Insiders\bin;C:\Users\Xin\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Windows Kits\8.1\Include;C:\Users\Xin\AppData\Local\Programs\Microsoft VS Code Insiders\bin;C:\Users\Xin\AppData\Roaming\npm
9 verbose lifecycle rtc-quickconnect@5.9.0~test3: CWD: C:\RepoNAA\rtc-quickconnect
10 silly lifecycle rtc-quickconnect@5.9.0~test3: Args: [ '/d /s /c', 'browserify test/all.js | broth start' ]
11 silly lifecycle rtc-quickconnect@5.9.0~test3: Returned: code: 1  signal: null
12 info lifecycle rtc-quickconnect@5.9.0~test3: Failed to exec test3 script
13 verbose stack Error: rtc-quickconnect@5.9.0 test3: `browserify test/all.js | broth start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\Xin\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:304: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> (C:\Users\Xin\AppData\Roaming\npm\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 rtc-quickconnect@5.9.0
15 verbose cwd C:\RepoNAA\rtc-quickconnect
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Xin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "test3"
18 verbose node v8.11.4
19 verbose npm  v6.4.0
20 error code ELIFECYCLE
21 error errno 1
22 error rtc-quickconnect@5.9.0 test3: `browserify test/all.js | broth start`
22 error Exit status 1
23 error Failed at the rtc-quickconnect@5.9.0 test3 script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

有什么方法可以找出导致错误的根本原因?

0 个答案:

没有答案