How To Manage Node Version On Windows Using nvm

09 May, 2023

nvm stands for Node Version Manager. With its help, you can switch between multiple Node.js versions based on projects you are working on. To clarify, nvm does not support Windows but MacOS and Linux. Instead, you can install nvm-windows and use it to install Node.js and manage versions of multiple installations. Without further ado, Let's begin to learn how to install it.

Prerequisite

  • Delete any existing Node.js installation directories - which is probably C:/Program Files/nodejs - you can just simply remove Node.js app from Apps

Download nvm

Go to the official repository to download nvm-windows. It looks like:

nvm-windows-git

After you click Download Now! and then, scroll down to Assets, click nvm-setup.exe to download nvm-windows.

nvm-setup-exe

Open the setup file and follow the installation wizard to install it. Once finished, you can open PowerShell or Command Prompt to confirm the installation. To do it, enter nvm -v as shown below:

nvm-version

Install Node

It is time to install Node using nvm-windows. Open either PowerShell or Command Prompt - Make sure you run it as an admistrator. Enter nvm install target-node-version-number as shown below:

install-node

Alternatively, you can just download lts version simply entering nvm install lts - The reason why Version 18.16.0 is already installed instead of being installed is that 18.16.0 is lts version now.

node-install-lts

You can also check out the list of Node versions to install entering nvm list available. So, feel free to install any version you want to use.

Choose Node Version

To check out Node versions installed on a machine, enter nvm list. It will show us the list of versions installed.

nvm-list

To use one of the versions. Enter nvm use target-node-version-number and confirm the node version you choose entering node -v.

nvm-use

If nvm-windows has been successfully installed, you are ready to handle different projects that are dependent on each of different Node versions.

THANKS FOR READING. SEE YOU NEXT TIME!