Setup for easy breasy heroku style - based on
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1 commit behind dennisburton:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Getting set up with node.js and Heroku

Source Tim Taylor


1. Install NVM

NVM - Node version manager

  • nvm will allow for switching versions of node and the packages installed with that version.
  • Heroku pins the version of node at 0.4.7.
  • Current version is 0.6.8


  • git
  • bash
  • Xcode, gcc, or other C++ compiler

Install NVM

git clone git:// ~/.nvm

Add this line to ~/.bashrc or ~/.profile or ~/.bash_profile

. ~/.nvm/

2. Install Node v0.4.7

nvm install v0.4.7
# downloads and compiles Node
nvm alias default v0.4.7
nvm use v0.4.7
node --version
# v0.4.7

NOTE: If using Ubuntu and you get an error that OpenSSL is not installed or available, one solution that has worked is to install/reinstall OpenSSL prior to installing Node v0.4.7 using nvm.

sudo apt-get install libssl-dev

Install NPM

curl | sh

I needed to sudu the sh in order to write to usr/bin

curl | sudo sh

2. Install Heroku CLI


Download Heroku CLI

Login to Heroku. You only have to do this once.

heroku login

Clone Meetup project

git clone git://
cd a2node-starter-heroku

Install Node modules required for project

npm install

NPM installs dependencies for our project that are declared in package.json. Each time we add a dependency to package.json we will re-run npm install.

Run locally

foreman start
# 16:29:15 web.1     | started with pid 35445
# 16:29:15 web.1     | Listening on 5000

Visit http://localhost:5000/

4. Review Node.js Project Structure

├── .git
│   ├── ...
├── .gitignore
├── Procfile
├── README.markdown
├── package.json
└── web.js


  • Change "Hello World" to "Hello, {You}", e.g. "Hello, node monkey"
  • Restart foreman, see your change locally
  • Commit your changes git add web.js git ci -m 'personalized greeting'

5. Deploy!

Create new Heroku app in your account. You do this once per app. Important: specifying Cedar is important. The original Heroku stack was Ruby only.

heroku create --stack cedar
# optionaly: heroku create --stack cedar friendly_app_name
# Creating sharp-rain-871... done, stack is cedar
# | # Git remote heroku added

Check out the placeholder app:

heroku open

Deploy your code:

git push heroku master
# ...

Your app!

heroku open

6. A little front-end

Add in express.static(...) for static file serving.


  • Change Procfile to point to web.static.js
  • restart Foreman and test out locally
  • Change the message displayed and test locally
  • Deploy to heroku
  • test remotely