Node Version Manager Preview

The Node Version Manager or nvm is a bash script for installing, and switching releases of NodeJS so that you can test your libraries (or deploy) using any release you need.

Tim (creationix) just started this library earlier today, so I forked away and started adding features and refactoring existing code. Currently to use my changes you have to clone my refactor branch:

  $ git clone git@github.com:visionmedia/nvm.git
  $ git pull origin refactor && git checkout refactor
  $ sudo make install

And add the following line to your profile to provide the nvm specific bin directory to $PATH.

  export PATH="$PATH:$HOME/.nvm/current/bin/"

It is super early in the game but already it is a handy little tool.

Installing A Release

The command below will install a release of node run:

  $ nvm install v0.1.91

Installing From HEAD

Installing node’s HEAD or “edge” is as simple as:

  $ nvm install head

which will clone the git repo and build from source. Sequential invocations of this same command will then pull, updating the repo and building from source again. This is a good way to keep with the times :)

Listing Installed Versions

The command list command (also aliased as ls) will list the installed versions, and prefix the active version with the * character.

    $ nvm list
        * head
        v0.1.91

Switching Versions

To switch or “use” a version simply run:

  $ nvm use v0.1.91

After which you should see:

  $ node --version
  0.1.91

If you have not previously installed the given version, then nvm will attempt to install it.

Remove Versions

You can remove “head” or any other version just like you installed it:

  $ nvm remove v0.1.90

This command is aliased as rm, and remove.

List Available Versions

To list the latest 10 releases of node run:

  $ nvm versions

which will output something like below, giving you a better idea of what you can install.

v0.1.91
v0.1.90
v0.1.9
v0.1.8
v0.1.7
v0.1.6
v0.1.5
v0.1.4
v0.1.33
v0.1.32

WOW COOL WHAT ELSE?

Another library you might be interested in, is the Kiwi package manager for node. Although it is in it’s early stages as well, it has served over 1700 packages (aka “seeds”), hosts 40 unique seeds, and over 107 versions of those.

Notes

  1. tjholowaychuk posted this