If you're used to pushing Rails apps to Heroku, deploying your first Node app could be a pretty frustrating experience.
It was for me.
Here's some tricks to help you deploy:
- Add Node as an engine dependency in your package.json file:
"engines": { "node": "4.1.1" },
- Delete your node modules and reinstall all your dependencies in your production environment. To do this, run `rm -rf node_modules` and `npm install --production`
- Double-check everything worked. Run `heroku local web` and visit http://localhost:5000 to see your app as it will appear once deployed.
- If everything looks good, deploy as usual.
$ git add . $ git commit -m "Added a Procfile." $ heroku login Enter your Heroku credentials. ... $ heroku create Creating arcane-lowlands-8408... done, stack is cedar http://arcane-lowlands-8408.herokuapp.com/ | git@heroku.com:arcane-lowlands-8408.git Git remote heroku added $ git push heroku master ... -----> Node.js app detected ... -----> Launching... done http://arcane-lowlands-8408.herokuapp.com deployed to Heroku
For more information on deploying Node apps to Heroku, read through Heroku's very helpful instructions.