DEV Community

Dhruv
Dhruv

Posted on

Using nvm

If you work on more than one project at a time or you do a lot of open source work or you decide to go back to a project you did a year ago there is a very high chance you will have to change your node.js version. There might be a few dependencies that will work only on a specific node.js version. You can use nvm to change your node.js versions in a second.

If you already do not have nvm installed. Download and install the latest version of nvm.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

Check your nvm version by
nvm โ€“ version

To download and install a new version of node.js run
nvm install 8.2
Replace 8.2 with the version number you need.

To check what versions of node.js are installed on your system run
nvm ls
This will list out all the versions you have installed.

To switch to any node.js version you need run
nvm use 8.2

If you do not want any particular node.js version you can uninstall it by
nvm uninstall 8.2

You can set the default node.js version by setting an alias
nvm alias default v9.3.0

This was originally published on Medium

Top comments (0)