Installation

If you are using mac the easiest way to install nvm is by Homebrew.

brew install nvm
nvm
Homebrew’s package index

If you are not using mac or if you don't have Homebrew install in your mac you can follow installation steps on the nvm GitHub page.

Using nvm to manage Node.js

First, check if you have install nvm successfully in your system. By doing,

nvm --version

Install the latest Node.js version

To install the latest available version of Node.js, you can use the following command:

nvm install node

To setup the default Node.js version that you would like to use in your system you can use the following command:

nvm use node

Install the latest Node.js LTS version

To install the latest available LTS version of Node.js, you can run the following command:

nvm install --lts

And then to use it you can do:

nvm use --lts