简体   繁体   English

将Node.js应用程序部署到Heroku的问题

[英]Issues with deploying Node.js app to Heroku

I am trying to deploy a simple app I created by following an online tutorial to Heroku. 我正在尝试通过遵循Heroku的在线教程来部署我创建的简单应用程序。 The app deployed fine but when I open it I get the following message: 该应用程序部署正常,但当我打开它时,我收到以下消息:

"An error occurred in the application and your page could not be served. Please try again in a few moments."

In the logs I see the following: 在日志中,我看到以下内容:

at=error code=H10 desc="App crashed" method=GET path="/" host=testapp.herokuapp.com request_id=245c73e7-1c11-4c98-8bb5-92dee6599ef2 fwd="64.46.7.78" dyno= connect= service= status=503 bytes=

All of the tutorials I have read online about deploying a Node.js app to Heroku say that I need to define a Procfile and add something like this: 我在网上看到的有关向Heroku部署Node.js应用程序的所有教程都说我需要定义一个Procfile并添加如下内容:

web: node server.js

I don't have a server.js file in my app so what file would I specify here? 我的应用程序中没有server.js文件,所以我在这里指定哪个文件? Would it be the app.js that I have in the root directory or the www file that I have in my bin folder? 它是我在根目录中的app.js还是我在bin文件夹中的www文件? I am really confused... 我真的很困惑......

Once I update the Procfile do I need to restart heroku or redeploy my whole app for it to take effect? 一旦我更新Procfile,我是否需要重新启动heroku或重新部署我的整个应用程序才能生效?

Thanks for the help! 谢谢您的帮助!

EDIT: 编辑:

A bit further above in the log I see the following: 在日志的上面,我看到以下内容:

2016-04-05T01:19:48.266570+00:00 app[web.1]: /app/node_modules/monk/node_modules/mongoskin/lib/utils.js:33
2016-04-05T01:19:48.266584+00:00 app[web.1]:   var skinClassName = 'Skin' + NativeClass.name;
2016-04-05T01:19:48.266585+00:00 app[web.1]:                                           ^
2016-04-05T01:19:48.266586+00:00 app[web.1]:
2016-04-05T01:19:48.266588+00:00 app[web.1]:     at makeSkinClass (/app/node_modules/monk/node_modules/mongoskin/lib/utils.js:33:43)
2016-04-05T01:19:48.266587+00:00 app[web.1]: TypeError: Cannot read property 'name' of undefined
2016-04-05T01:19:48.266589+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/monk/node_modules/mongoskin/lib/grid.js:6:35)
2016-04-05T01:19:48.266589+00:00 app[web.1]:     at Module._compile (module.js:413:34)
2016-04-05T01:19:48.266590+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:422:10)
2016-04-05T01:19:48.266591+00:00 app[web.1]:     at Module.load (module.js:357:32)
2016-04-05T01:19:48.266591+00:00 app[web.1]:     at Function.Module._load (module.js:314:12)
2016-04-05T01:19:48.266592+00:00 app[web.1]:     at Module.require (module.js:367:17)
2016-04-05T01:19:48.266592+00:00 app[web.1]:     at require (internal/module.js:16:19)
2016-04-05T01:19:48.266594+00:00 app[web.1]:     at Module._compile (module.js:413:34)
2016-04-05T01:19:48.266593+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/monk/node_modules/mongoskin/lib/db.js:22:16)

Is this what is triggering the error with the app? 这是什么触发了应用程序的错误?

修复此模块的临时解决方案是将mongodb@1.4.4添加为依赖项,因为问题源于mongoskin(意外地)切换到mongodb@2.X的对等依赖项,它不支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM