Alessio Breviglieri Alessio Breviglieri - 1 year ago 127
Node.js Question

Deploying Node.js Apps on Heroku

I'm a beginner. I was tryng to deploy an "app" on Heroku but it doesn't work when going to It works fine with

heroku local
Really don't know what else to check.

This is what I've got in my logs:

2015-12-28T10:56:44.862230+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" request_id=c0994f20-ef28-4cad-95ba-f861a89d698d fwd="" dyno= connect= service= status=503 bytes=
2015-12-28T10:56:45.457317+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" request_id=a3286f8e-7051-419d-9e3d-ccb2090659c0 fwd="" dyno= connect= service= status=503 bytes=

I also get those npm:

2015-12-28T11:21:07.264470+00:00 heroku[web.1]: State changed from crashed to starting
2015-12-28T11:21:08.151361+00:00 heroku[web.1]: Starting process with command `npm start`
2015-12-28T11:21:10.533548+00:00 app[web.1]: npm ERR! Linux 3.13.0-71-generic
2015-12-28T11:21:10.534886+00:00 app[web.1]: npm ERR! node v0.12.7
2015-12-28T11:21:10.534398+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2015-12-28T11:21:10.535773+00:00 app[web.1]: npm ERR! npm v2.11.3
2015-12-28T11:21:10.536011+00:00 app[web.1]:
2015-12-28T11:21:10.536325+00:00 app[web.1]: npm ERR! missing script: start
2015-12-28T11:21:10.536603+00:00 app[web.1]: npm ERR!
2015-12-28T11:21:10.536829+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2015-12-28T11:21:10.537055+00:00 app[web.1]: npm ERR! <>
2015-12-28T11:21:10.544211+00:00 app[web.1]:
2015-12-28T11:21:10.544631+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2015-12-28T11:21:10.544950+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2015-12-28T11:21:11.360279+00:00 heroku[web.1]: State changed from starting to crashed
2015-12-28T11:21:11.348180+00:00 heroku[web.1]: Process exited with status 1
2015-12-28T11:35:00.705391+00:00 heroku[api]: Starting process with command `node console` by
2015-12-28T11:35:02.612018+00:00 heroku[run.1521]: Awaiting client
2015-12-28T11:35:02.882034+00:00 heroku[run.1521]: State changed from starting to up
2015-12-28T11:35:32.616428+00:00 heroku[run.1521]: Error R13 (Attach error) -> Failed to attach to process
2015-12-28T11:35:33.493974+00:00 heroku[run.1521]: Process exited with status 128
2015-12-28T11:35:33.493559+00:00 heroku[run.1521]: State changed from up to complete

My app.js file:

var router = require('./router.js');
var port = process.env.PORT || 3000;

//Create a web server
var http = require('http');
http.createServer(function (request, response) {
router.home(request, response);
console.log('Server running');


web: node app.js


"name": "lorem_ipsum",
"version": "1.0.0",
"description": "Lorem Ipsum Generator",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"author": "Alessio",
"license": "MIT",
"keywords": [
"engines": {
"node": "0.12.7"

Answer Source

You need to add

"start": "node app.js"

to the "scripts" section of your package.json.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download