in Code

Node Version Manager (NVM)

April 13, 2013
Node.js has a great package manager to manage the dependencies of your Node projects, but what about managing the versions of Node itself? Ruby has a version manager called RVM that most folks in the community know to use right from the start. I've installed Node, like most others, using the default installer provided by Node. This (more than likely) requires sudo access because of where the default install location resides, and additionally will require sudo access when installing packages globally. And that decision leads to huge confusion initially (see here and here and even here) because running things blindly with sudo is bad, much like crossing the streams (right Egon?).

So maybe it was my lack of knowledge in the Node community, but I recently found out about NVM, a version manager much like RVM, which avoids the sudo problem by installing to your home directory. It provides easy access to install multiple versions of Node, and switch versions easily. Your NPM global packages are installed along side the specific version of Node, so they don't mix when switching between versions. And of course you can set a default Node version which will be used when starting a terminal/command prompt. After using NVM for a bit, I highly recommend it over other Node install options. (I've even uninstalled Node from the default installer location.)

Check it out!