Avoiding pitfalls when setting up Heroku for Node.js on Ubuntu

Heroku has an excellent introduction to deploying your first node.js project on their PaaS-tastic Cedar stack. However, there are a few key points to keep in mind:

  1. If you’re new to Heroku and focused exclusively on Node.js, then you’ll likely be developing on Ubuntu and need to install the Heroku command-line client. You’ll find instructions on what to type into the console here. However, if you’re using a default Ubuntu install, then you’ll probably need to use the sudo command on these…and you may get an error when typing in the second line

$ curl http://toolbelt.herokuapp.com/apt/release.key | apt-key add –

that says

$ % Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

100 2442 100 2442 0 0 2273 0 0:00:01 0:00:01 –:–:– 5856

gpg: no writable keyring found: eof

gpg: error reading `-‘: general error

gpg: import from `-‘ failed: general error

This is an easy one to fix, and is simply a permissions error on the apt-key program. Try this code, and it should work

$ curl http://toolbelt.herokuapp.com/apt/release.key | sudo apt-key add –

  1. Next, after a seemingly successful install of the Heroku command-line client, when typing in

$ heroku login

You might get back

$ /usr/bin/env: ruby: No such file or directory

This is because Heroku requires Ruby to run. Luckily, again, an easy fix…just make sure not to install more than you need (i.e., you definitely don’t want to install Apache or Ruby servers, etc.) if you stumble upon this site. This should be the only installation you need to get going

$ sudo aptitude install ruby build-essential libopenssl-ruby ruby1.8-dev

Leave a Comment