简体   繁体   中英

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. 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:

web: node server.js

I don't have a server.js file in my app so what file would I specify here? Would it be the app.js that I have in the root directory or the www file that I have in my bin folder? 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?

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的对等依赖项,它不支持。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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