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:

/home/pkrumins/installs/node-v0.8.20
/home/pkrumins/installs/node-v0.8.21
/home/pkrumins/installs/node-v0.10.3
/home/pkrumins/installs/node-v0.10.22

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
  PATH=$node_path:$PATH
}

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
/home/pkrumins/installs/node-v0.8.21/bin/node
$ node --version
v0.8.21

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

$ chnode 0.6.18
$ which node
/home/pkrumins/installs/node-v0.6.18/bin/node
$ node --version
v0.6.18

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

Comments

Patrick Kettner Permalink
February 12, 2014, 22:02

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

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.

May 02, 2014, 09:49

Big thanks for this tips!
forum młodzieżowe .

June 06, 2014, 13:19

Nowoczesny flat design tworzenie stron opole atrakcyjne ceny.

August 24, 2014, 16:43

Useful information. Fortunate me I found your site by accident, and I am surprised why this coincidence didn’t took place earlier! I bookmarked it.

November 27, 2014, 17:00

Multiple node is a great work of you sir.
I will be using it now on on happy new year 2015 messages, happy new year greetings 2015, merry christmas 2014 wishes, happy new year 2015 wishes. Thanks for the updates.

November 29, 2014, 08:54

Articles and photos on this site is interesting. Thank you for this material

December 02, 2014, 18:15

It would be great for our site!

Regards
http://supple.pl/
Anka Winiarska

Kaur deep Permalink
December 04, 2014, 03:09

Excellent and knowledgeable links and post.thanks for sharing.
Now, The Time has come for the Happy New Year 2015. It wil bring a lot fo happinesin our life.
Happy New Year 2015
And I am sure, You wil anjoy this new year day with yoru fiends and wil send some images wishes,
New Year 2015

Happy New Year 2015 Wishes
Greetings to yoru close ones, Your friends, You lover, etc..
Happy New Year 2015 Images
Even I am waititng for that day, because it just changes our life.
Happy New Year 2015 Greetings

Happy New Year 2015 SMS
So, That's why I am commenting here to wish you a very happy new year.
Happy New Year 2015 Messages
I hope this New year 2015 wil bring success to your website. But before that Merry Christmas is coming.
Merry Christmas Quotes
It is also a big event for everyone.
Merry Christmas Pictures
Everyone knows that Christmas is a day when People seems to be very happy, they just leave all sadness behind.
Merry Christmas Wallpapers
And I am sure, you also enjoy this Merry Christmas day of 2014.
Christmas day Images

Christmas stocking
But if you are not looking out to enjoy this christmas, then you are missing out on a big thing, because it really brings happiness.
Merry Christmas Images

Merry Christmas 2014
So, what you are waiting for?
Merry Christmas 2015
Enjoy This Merry Christmas day. Cheers :).

December 05, 2014, 20:07

Really this site is very informative.good coding source indeed.
new year wishes messages
new year wishes messages for facebook
new year wishes messages for family and friends.A must read list for this new year.

Diana Permalink
December 17, 2014, 15:52

This article is quite helpful and informative too. I enjoyed a lot. Thanks for sharing such a great article.

Beautiful Christmas Quotes for your friends and family...
christmas quotes
Christmas Messages for Whatsapp

Best Christmas Greetings for your friends and family...
christmas greeting
christmas wishes

What to Write in Christmas Card....... Check out best Christmas Greeting Card Words
What to Write in Christmas Card

Get Beautiful and Unique Christmas Wallpapers for free
free christmas wallpaper
christmas tree decorating ideas

Thanks for sharing such a great article.

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 "server_412": (just to make sure you're a human)

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

Advertisements