Ray C Ray C - 1 year ago 64
Node.js Question

Hroku issue on Deploying Node.js project - simple one

I have recently deployed simple node.js work which does web chatting, really simple piece of codes. But when I visited the URL deployed, it is said following:

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

If you are the application owner, check your logs for details.

I have checked the log which is saying:

2016-10-18T05:25:28.021356+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-10-18T05:25:28.021357+00:00 app[web.1]: at Object.<anonymous> (/app/app/web/index.js:3:17)
2016-10-18T05:25:28.021357+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-10-18T05:25:28.021356+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-10-18T05:25:28.021358+00:00 app[web.1]: at Object.Module._extensions..js (module.js:416:10)
2016-10-18T05:25:28.021358+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-10-18T05:25:28.021359+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-10-18T05:25:28.021370+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-10-18T05:25:28.152443+00:00 heroku[web.1]: State changed from starting to crashed
2016-10-18T05:25:28.982052+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=realtime-web-chat-simple.herokuapp.com request_id=93c0506d-02e9-4505-a357-9e8d6578d007 fwd="" dyno= connect= service= status=503 bytes=
2016-10-18T05:25:30.286843+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=realtime-web-chat-simple.herokuapp.com request_id=2a3caade-896a-4ae2-8fd9-6e5ec66fed78 fwd="" dyno= connect= service= status=503 bytes=

My package.json is following:

"name": "RealTimeWebChat",
"version": "0.0.0",
"description": "real time web chat using node.js power :D",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
"repository": {
"type": "git",
"url": "git+https://github.com/CodeKnight986/webchat.git"
"keywords": [],
"author": "",
"dependencies": {
"socket.io": "latest",
"express-handlebars": "3.0.0",
"express-session": "1.13.0",
"passport": "0.3.2",
"passport-local": "1.0.0",
"html-entities": "1.2.0"
"author": "ray - codeknight"

Any help will be appreciated.

Answer Source

Well, have you set correct port when to listen? When to deploy to Heroku, you must use following port:

process.env.PORT || {your-config-port}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download