Node.js Heroku app crashes with Error R10 (Boot timeout) `heroku restart` not working-Collection of common programming errors

Using the below code from an example I found, my Heroku Node.js app crashes. It is not responding when I navigate to [myapp].herokuapp.com

var http = require('http');
var port = process.env.PORT || 8000;

var counter = 0;

http.createServer(function (req, res) {

// increment the counter for each visitor request
counter=counter+1;

var path = req.url;
console.log("requested=" + path + " counter=" + counter);

res.writeHead(200, {'Content-Type': 'text/html'}); // prepare response headers

res.end(" :) "); 

}).listen(port);

my procfile is

web: node thenameofmyapp.js

I have done heroku ps:scale web=1

I had some dependencies but removed them to try to get a simple app to work. My current package.json is

{
  "name": "thenameofmyapp",
  "version": "0.0.3",
  "dependencies": {
  },
  "engines": {
    "node": "0.10.x",
    "npm": "1.2.x"
  }
}

Why can’t my app bind to the port?

EDIT: It looks like even after multiple updates and running heroku restart, my app is still running code that doesn’t exist anymore. What’s going on here?

  1. I’m not completely sure what happened, but it looked like Heroku was not restarting when I pushed new code or ran heroku restart. I created a new app with the same code and it works.

    One difference someone else might want to test is that I removed node_packages from my git repo before pushing to the new app.