When developing Node.js applications you might face situations where you need to use multiple versions of Node but you also would like to use N|Solid. Without a good tool this would mean a lot of work and effort to create the perfect setup manually. Fortunately, there is an option to create this kind of setup easily.

Implementing and configuring N|Solid with nvm

nvm meaning Node Version Manager, is a great solution that let you easily manage all your node installations and change node versions whenever you need it.

Installing N|Solid

The first step would be to install N|Solid, you should install the runtime as described in our documentation

After this process N|Solid will be your default Node version.

_Note: When using the MacOSX Installer, due to an exisiting bug in the official Node.js installer for MacOSX, it's highly recommended to delete the current npm installation folder previous to the installation of the N|Solid runtime, you can remove it by executing: $ rm -rf /usr/local/lib/node_modules/npm_

Installing the tool

Before installing make sure your system has a c++ compiler. For OSX, you can use XCode or Command Line Tools. For Ubuntu, use the build-essential and libssl-dev packages.

To install you can use curl or wget:

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash

Installing other Node.js versions

You can list all versions available using the command:

$ nvm ls-remote

To install a specific version, you just need to run the command with the option install, and use the desired version as the final argument:

$ nvm install v8.0.0

There is also an option to install the latest LTS version with:

$ nvm install --lts

Switching versions

You can check what versions are installed when you execute:

$ nvm ls

You should be able to see all versions already installed and N|Solid will show up as system, to use it just execute:

$ nvm use system

There is a bug when installing dependencies requiring node-gyp builds to fail while using nvm and N|Solid, to prevent any problem, right after switch to N|Solid, please execute:

$ unset NVM_NODEJS_ORG_MIRROR

To change to another node version, just use the version number:

$ nvm use v8.0.0

To use the latest LTS:

$ nvm use --lts

You can find more information about using nvm here