How to switch from one version of Node.js to another with NVM

NicolasBrondinBernard

Author
@NicolasBrondinBernard

The essential and easy-to-use CLI tool!

Article published on 12/11/2021, last updated on 10/08/2026

If you work on several projects developed with NodeJS in your daily routine, some of which were inherited from other developers and deployed several years ago, you may run into version compatibility issues.

When you switch from one project to another, it's possible to reinstall your Node version each time (even though this is counterproductive), but if you alternate very frequently between these projects, it becomes problematic.

Fortunately, there is a version manager for NodeJS called "NVM" (for Node Version Manager, not really original).

How to install it?

You should know that the original version of this tool only works on MacOS, Linux and on Windows WSL (Windows Subsystem for Linux), but an alternative and equally reliable version exists for Windows.

MacOS and Linux

To install the tool, simply download the installation script and run it, directly from your terminal by doing:

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
# ou
$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

If you encounter a problem during installation, I'll let you visit the project's official Github repository: https://github.com/nvm-sh/nvm

Windows

Before installing nvm on Windows, it is recommended to uninstall any previously installed version of node on the machine, as well as delete all NPM folders to avoid any conflict.

If you need to carry out this operation, I'll let you refer to the documentation on Github which will guide you through all the paths to check: https://github.com/coreybutler/nvm-windows

Once done, you'll just need to download the installer (nvm-setup.exe) available at this address, and follow the standard installation procedure!

How to use it?

Even though the installation method differs and the source code is not the same, you'll be able to use the command line tool in the same way, except for a few commands whose syntax changes very slightly.

Installing a new version

# MacOS, Linux et Windows
$ nvm install 14.15.1

Activating a version

# MacOS, Linux et Windows
$ nvm use 14.15.1

Listing installed versions

# Windows
$ nvm list
#MacOS et Linux
$ nvm ls

Listing versions available for installation

# Windows
$ nvm list available
#MacOS et Linux
$ nvm ls-remote

Uninstalling a version

# MacOS, Linux et Windows
$ nvm uninstall 14.15.1

Notes

  • NPM is included with every version of NodeJS, but if you use Yarn, you'll need to reinstall it for each new version of Node.
  • There are a few platform-specific commands available, I recommend that you consult the documentation available on Github, the links are in the "How to install it?" section.

Anne Nygård sur Unsplash

Finished reading this article?
Our complete courses
Take it to the next level with our courses!

Complete courses, exercises and certificates to really learn programming!

4.8 average rating

Comments (0)

to leave a comment

No comments yet