执行 npm 命令时出现问题
Posted
技术标签:
【中文标题】执行 npm 命令时出现问题【英文标题】:Issue while executing npm commands 【发布时间】:2018-05-19 03:33:27 【问题描述】:同时在一台机器上多次运行 npm 命令时,我们面临以下问题。
此问题随机发生。找不到任何根本原因。
详细信息附在下面的错误日志中
错误日志:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'coverage' ]
2 info using npm@5.3.0
3 info using node@v6.4.0
4 verbose run-script [ 'precoverage', 'coverage', 'postcoverage' ]
5 info lifecycle gulp-karma@1.0.0~precoverage: gulp-karma@1.0.0
6 info lifecycle gulp-karma@1.0.0~coverage: gulp-karma@1.0.0
7 verbose lifecycle gulp-karma@1.0.0~coverage: unsafe-perm in lifecycle true
8 verbose lifecycle gulp-karma@1.0.0~coverage:
9 verbose lifecycle gulp-karma@1.0.0~coverage: CWD: D:\workspace\TestGroup\viewer
10 silly lifecycle gulp-karma@1.0.0~coverage: Args: [ '/d /s /c',
10 silly lifecycle 'concurrently "gulp common" "gulp feature" "gulp file" "gulp layout" "gulp widget_zero" "gulp widget_one" "gulp mobile_common" "gulp mobile_feature" "gulp mobile_file" "gulp mobile_layout" "gulp mobile_widget"' ]
11 silly lifecycle gulp-karma@1.0.0~coverage: Returned: code: 1 signal: null
12 info lifecycle gulp-karma@1.0.0~coverage: Failed to exec coverage script
13 verbose stack Error: gulp-karma@1.0.0 coverage: `concurrently "gulp common" "gulp feature" "gulp file" "gulp layout" "gulp widget_zero" "gulp widget_one" "gulp mobile_common" "gulp mobile_feature" "gulp mobile_file" "gulp mobile_layout" "gulp mobile_widget"`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:289:16)
13 verbose stack at emitTwo (events.js:125:13)
13 verbose stack at EventEmitter.emit (events.js:213:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
13 verbose stack at emitTwo (events.js:125:13)
13 verbose stack at ChildProcess.emit (events.js:213:7)
13 verbose stack at maybeClose (internal/child_process.js:927:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid gulp-karma@1.0.0
15 verbose cwd D:\workspace\TestGroup\viewer
16 verbose Windows_NT 10.0.14393
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "coverage"
18 verbose node v6.4.0
19 verbose npm v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error gulp-karma@1.0.0 coverage: `concurrently "gulp common" "gulp feature" "gulp file
如果有人帮助我解决问题,将不胜感激
【问题讨论】:
你用什么命令来得到这个错误? @BozhinovskiVladimir npm 运行覆盖率 尝试清除 node_modules 并在此之后安装 npm。 @BozhinovskiVladimir 我们在同时从不同的PowerShell提示符(3)多次运行npm命令时面临这个问题。那么,清除 node_modules 不会影响其他两个进程吗?注意:很明显,在一台机器上安排了三个自动化,用于与 Jenkins 的持续集成过程。 我们使用不同的端口来运行每个 karma 配置的命令。会有问题吗? 【参考方案1】:您的命令concurrently
似乎返回“EXIT_FAILURE”退出代码,这可能是由您的任何 gulp 任务内部的 javascript 错误引起的。因为我不知道这些任务是做什么的,所以我无法真正帮助你。您可以单独运行每个命令以找到返回错误的命令。
【讨论】:
以上是关于执行 npm 命令时出现问题的主要内容,如果未能解决你的问题,请参考以下文章
在下面执行 npm install gettng 时出现 react-native 错误