Installing NVM for Node.js

Step 1: Download nvm

If you're on linux you may first need curl

The following command will automatically install nvm using curl

Step 2: Verify installation

Install current LTS version of Node.js

First we install it by running the following

Next we can activate it

Install latest version of Node.js

First we install it by running the following

Next we can activate it

Add the following to your bash_profile

The first two lines nvm adds itself to your .bashrc

The third line will give you autocomplete with nvm which is nice

I recommend adding it to your .bash_profile because that is typically where I add all of my exports

Wrap up

We now have the latest version of Node.js as well as the long term support release installed.

You are free to switch between the two using the use command.


Tagged in nodejs