【问题标题】:Heroku Contacts App: node server.js fails to runHeroku 联系人应用程序:节点 server.js 无法运行
【发布时间】:2016-07-21 09:45:30
【问题描述】:

我从Heroku startup guide 得到项目并成功部署。但是,当我尝试在本地运行它时,我遇到了这个错误:

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   'start' ]
2 info using npm@2.15.5
3 info using node@v4.4.5
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart MEAN@1.0.0
6 info start MEAN@1.0.0
7 verbose unsafe-perm in lifecycle true
8 info MEAN@1.0.0 Failed to exec start script
9 verbose stack Error: MEAN@1.0.0 start: `node server.js`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (C:\Program    Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:217:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:827:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid MEAN@1.0.0
11 verbose cwd C:\Users\kmagl\Documents\CuttingEdge\new-project4
12 error Windows_NT 10.0.10586
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error node v4.4.5
15 error npm  v2.15.5
16 error code ELIFECYCLE
17 error MEAN@1.0.0 start: `node server.js`
17 error Exit status 1
18 error Failed at the MEAN@1.0.0 start script 'node server.js'.
18 error This is most likely a problem with the MEAN package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     node server.js
18 error You can get information on how to open an issue for this project with:
18 error     npm bugs MEAN
18 error Or if that isn't available, you can get their info via:
18 error
18 error     npm owner ls MEAN
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

我希望得到一些帮助。我和其他一些人此时遇到了麻烦。

【问题讨论】:

    标签: node.js heroku npm


    【解决方案1】:

    确保您已在本地运行 npm install,并且您有一个名为 MONGODB_URI 的环境变量,该变量具有指向正在运行的 mongodb 实例的有效 URL。

    另外,如果您从命令行调用node server.js,您可能会发现更详细的日志记录来帮助您缩小问题范围; npm 发出的一个通常是非常不透明的。

    【讨论】:

    • 感谢您的回复!我已经安装了必要的依赖项。我将不得不检查 MONGODB_URI。查看 server.js 的 URI 被称为我只是不记得我的计算机是如何离开的。明天再看。
    猜你喜欢
    • 2022-06-11
    • 2014-01-19
    • 2018-03-05
    • 1970-01-01
    • 2017-05-18
    • 2013-06-19
    • 2015-10-08
    • 2022-06-15
    • 1970-01-01
    相关资源
    最近更新 更多