I am fairly new to all of these technologies (including somewhat JavaScript) so you might have to bear with me here.
I followed the ChatApp tutorial over at Socket.IO do
Disclosure: I'm the Node Platform Owner at Heroku
First, you should run heroku logs
to get logging output.
Second, do you mean to have commented out listen
on your server? Without this, your server won't allow any incoming connections:
// http.listen(3000, function(){
// console.log('listening on *:3000');
// });
Finally, instead of binding to a hardcoded port (3000), you should bind to an environment variable with a default:
http.listen(process.env.PORT || 3000, function(){
console.log('listening on', http.address().port);
});
Check all your dependency. You could confirm it by cross checking your package.json or rather do refresh installation of all the dependencies in your package.json
I encountered the same error, but including "start":"node app.js"
in package.json file tends to fix the problem. Hope this helps anyone that encounters the same error.
Note: app.js should be your own main server file.
After checking heroku logs
I was able to find out that my bcrypt dependency defined properly in package.json. I would recommend you:
npm install
git push heroku
I also encountered this error after not using my Node app for several weeks. The reason appeared to be that not only had the app gone to sleep, but the database and its connection had too. I'm using a free MongoDB instance hosted by MongoLab.
I fixed this by running my local copy of the app, causing MongoLab to awaken. Then after a few minutes, my Heroku-hosted app started working again.