I recently started playing with Node.js, and while I can play locally just fine, I wanted to make sure I had a place to host once I had something worth hosting. Enter Heroku. Why? Because it’s free to host until you draw some real traffic, it has a really cool addon ecosystem with a great collection of services and I knew other people using it so I could turn to them if I had problems.
In order to get your application on their service, you need to install their command line tool, which requires Ruby. No problem, just install it all with apt-get and you’re good to go, right? Short answer, yes. Long answer, No. You’ll be using an unsupported version (the version of ruby in the Ubuntu repos is aged), so while it might work now, it may not in the future. If you do like I did, you’ll also end up with 1.8 and 1.9 on your machine, and while that didn’t cause any problems, it seemed silly.
Poking around, I found this article which lays out how to use RVM to both install a newer version of Ruby as well as easily update it in the future. So, here’s the whole shebang:
And that’s it. You now have a local version of Ruby and Rubygems for you to use. If you want to keep your version of Node local as well, you can use the
--prefix when compiling, as explained in the Node wiki.
Now you’re ready to continue along with the Heroku docs and get your Node app deployed on their server.