当我尝试启动快速服务器时出现错误,而对于我的生活,我无法找到原因。它工作了一段时间,并停止工作,但我不知道我会改变什么会打破它。
这是输出:
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'start' ]
2 info using npm@2.7.4
3 info using node@v0.12.2
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart mathlab@0.0.0
6 info start mathlab@0.0.0
7 verbose unsafe-perm in lifecycle true
8 info mathlab@0.0.0 Failed to exec start script
9 verbose stack Error: mathlab@0.0.0 start: `node ./bin/www`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:14:12)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid mathlab@0.0.0
11 verbose cwd /Users/alangm/Documents/localgit/mathlab
12 error Darwin 14.1.0
13 error argv "node" "/usr/local/bin/npm" "start"
14 error node v0.12.2
15 error npm v2.7.4
16 error code ELIFECYCLE
17 error mathlab@0.0.0 start: `node ./bin/www`
17 error Exit status 1
18 error Failed at the mathlab@0.0.0 start script 'node ./bin/www'.
18 error This is most likely a problem with the mathlab package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node ./bin/www
18 error You can get their info via:
18 error npm owner ls mathlab
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
答案 0 :(得分:0)
希望这会有所帮助:
最新版本的npm,可能是2.0,如果节点被npm以外的其他东西杀死,则npm脚本会抛出错误。我不确定当一个子进程被杀死时是否会发生这种情况。
尝试将此添加到您的脚本中:
process.on('SIGTERM', function(){
console.log('Detected kill signal');
process.exit()
})