【问题标题】:Error starting express server启动快速服务器时出错
【发布时间】:2015-06-11 09:25:28
【问题描述】:

当我尝试启动我的快递服务器时,我遇到了一个错误,我终其一生都找不到原因。它工作了一段时间,然后停止工作,但我不知道我会改变什么会破坏它。

这是输出:

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 ]

【问题讨论】:

    标签: node.js express mongoose npm


    【解决方案1】:

    希望这会有所帮助:

    最新版本的 npm,可能是 2.0,如果 node 被 npm 以外的东西杀死,npm 脚本会抛出错误。我不确定当子进程被杀死时是否会发生这种情况。

    尝试将此添加到您的脚本中:

    process.on('SIGTERM', function(){
      console.log('Detected kill signal');
      process.exit()
    })
    

    【讨论】:

    • 如果您自己没有终止该进程,则可能会出现其他问题。你自己在用child_process.spawn吗?还是只是 npm?
    • 另外,在没有 npm 的情况下运行它会失败吗? node ./bin/www?
    猜你喜欢
    • 1970-01-01
    • 2012-04-18
    • 2011-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多