Install NVM on Windows

Install NVM on Windows

Introduction

In this article, I will talk about how to install NVM(node version manager) on a Windows computer and also about why you should use NVM as well as the different commands.

What is NVM

NVM stands for Node Version Manager. This allows you to change you're Node.js version to a new or older version of Node.js.

Why you should use NVM

NVM is helpful for multiple reasons, if you're setting up the developer environment for a Node project from GitHub you might face errors with running the project because it could be using an older version of Node.js but with NVM you can change the current Node.js version to an older version within a few seconds. If you trying to accomplish something like this without NVM then it would be more time-consuming and difficult.

Installation

If you have Node.js installed already then please uninstall it and restart your pc.

Once you've done that go to this link: https://github.com/coreybutler/nvm-windows#installation--upgrades and click Download Now! :

Click on the latest version to download it:

Locate the installer on your computer and open it. Follow the installation wizard to install it:

Open up Command Prompt and type nvm -v to confirm the installation:

Commands

Open up cmd and click Run as Administrator:

To install the latest version of Node, type nvm install latest

To install the LTS version of Node, type nvm install lts.

To install a specific version of Node, you need to type nvm list available to see all of the available Node versions:

To install a version, type nvm install node-version-number for example: nvm install 14.20.0.

To see all of the Node versions you have installed, type nvm list.

Set a default version of Node.js to be used whenever you open and run a project. Type this in the command prompt nvm alias default 14.17.5. After running this command, whenever you open a project the Node.js version will be set to version 14.17.5 as the default version, unless you explicitly switch to a different version using other NVM commands like nvm use version_number .

References

https://www.freecodecamp.org/news/nvm-for-windows-how-to-download-and-install-node-version-manager-in-windows-10/#:~:text=To%20install%20a%20specific%20version,0%20.