Is there virtualenv for Node.js?

nvm by Tim Caswell

Check out nvm by Tim Caswell, it's a version manager for Node.js. It allows you to install multiple version of Node.js in parallel, and also manages version-independent variants of the global module cache for you. With nvm it basically comes down to:

$ nvm install 0.10.24
$ nvm use 0.10.24

And then you have Node.js 0.10.24 up and running, including the appropriate version of npm.

Installation of nvm is as easy as running a simple shell command:

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

Another option may be n by TJ Holowaychuk or nave by Isaac Z. Schlueter, although I don't have any experience with either of them.

n by TJ Holowaychuk

Basically, they work quite similar to nvm. Installing n is as easy as running a shell script, too:

$ make install

Afterwards you are able to type:

$ n 0.10.24
$ n

Then you can select which installed version you'd like to use. From what I've heard n works better than nvm if you are on Windows.

nave by Isaac Z. Schlueter

nave is a shell script, again, and its usage is similar to that of nvm:

$ nave install 0.10.24
$ nave use 0.10.24

And that's it :-)!

Tags:

Node.Js