This is going to be a quick tutorial on how to run multiple node versions side by side. There are many different ways to do it but this works well for me.

First I compile node versions from source and I set them up in the following directory structure:


When compiling node I simply specify --prefix=/home/pkrumins/installs/node-vVERSION, and make install installs it into that path.

Next I've this bash alias:

function chnode {
  local node_path="/home/pkrumins/installs/node-v$1/bin"
  test -z "$1" && echo "usage: chnode <node version>" && return
  test ! -d "$node_path" && echo "node version $1 doesn't exist" && return

Now when I want to run node 0.8.21, I run chnode 0.8.21 to update the path:

$ chnode 0.8.21
$ which node
$ node --version

Or if I want to run node 0.6.18, I run chnode 0.6.18:

$ chnode 0.6.18
$ which node
$ node --version

Works for me both locally and in production. Until next time.


Patrick Kettner Permalink
February 12, 2014, 22:02

Is there a reason you like doing this rather than nvm?

February 12, 2014, 22:15

I've simply been using this before nvm existed so I never tried it.

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "cloud_412": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.