DEV Community

Cover image for How to install Node Version Manager (NVM) for Windows 10?
skaytech
skaytech

Posted on

How to install Node Version Manager (NVM) for Windows 10?

Introduction

I had recently purchased a Windows 10 laptop and I wanted to install Node.js. I usually prefer to use a Node Version Manager to install Node.js.

The reason I choose to do that is because I usually have to work with multiple applications that need require different Node.js versions, and using a node version manager (NVM) it is very easy to switch versions.

This article is more of a user guide for folks who are interested to install a Node Version Manager for Windows 10 Operating System.

A Quick Look at the Key Terminologies

I wanted to mention the following terminologies for absolute beginners. So, feel free, to skip this section, if you are already familiar.

  • nvm - Node Version Manager. It is a tool that allows you to download and install Node.js. It allows you to pick and choose the Node.js version that you wish to use.

  • Node.js - It is a platform for running JavaScript applications.

  • npm - Node Package Manager. It is a tool that allows you to install JavaScript packages. npm comes along with Node.js. So, if you have installed Node.js, you'll have npm installed as well.

Installing NVM for Windows 10

Go to the nvm-windows Git Repository

  • Using your browser navigate to the Git repository for nvm-windows located over here.

  • Click on the 'nvm-setup.zip' link from the 'assets' table as shown in the image below.

1-url.png

Locate the Zip File & Extract

  • The Zip file should have been downloaded to your Downloads folder (or where ever you have configured your downloads to be saved).

2-zip.png

  • Unzip/Extract the contents to the same folder.

3-extract.png

4-extract2.png

  • You should have the file nvm-setup.exe extracted in the same folder.

5-executable.png

Install NVM

  • Double-Click on the executable file to launch the installer.

  • Choose 'I accept the agreement' option.

6-accept.png

  • Select destination to install.

7-pathtoinstall.png

  • Select Symlink for Node.js.

8-symlink.png

  • Click on Install & once it completes, click on the 'Finish' button.

9-install.png

10-finish.png

Confirm that the 'NVM' successfully installed

  • Open your command line terminal

  • Type the below command to verify if your nvm installation was successful.

$ nvm --version
Enter fullscreen mode Exit fullscreen mode

11-checknvm.png

Install npm

  • You can now install 'npm' using the following command.
  $ nvm install latest 
  //installs the latest version of npm

  $ nvm install <<version number>> 
  //e.g. nvm install 12.6.8 to install a specific npm version

Enter fullscreen mode Exit fullscreen mode
  • Let us install the latest version of npm. (As of Sep 2020)

12-installnpm.png

Specify the version of npm that you choose to use

  • Using the below command to specify the version of npm that you wish to use. In our case, since we have only one version installed. Let's go with that.
$ nvm use 14.9.0
Enter fullscreen mode Exit fullscreen mode

13-usenpm.png

Check npm & nodejs versions

  • You can confirm the nodejs and npm versions through the commands below.

//Check Node.js version
$ node --version

//Check npm version
$ npm --version

Enter fullscreen mode Exit fullscreen mode

14-checknpmnode.png

Install Another npm Version

  • Repeat the above steps

15-installdiffversion.png

  • Install Completed & Select the version using the 'nvm use' command

16-finishinstall.png

17-useversion.png

  • Confirm that the environment now points to the new Node.js and npm versions

18-confirmversion.png

List all Versions

  • You can use the nvm list command to list all the npm and Node.js versions installed.
$ nvm list
Enter fullscreen mode Exit fullscreen mode

19-listversions.png

Conclusion

I hope the detailed user-guide helped you setup the Node Version Manager (nvm) in your Windows 10 machine. Thank you for reading the article and do share it if you found it useful.

Cover Photo by Christina @ wocintechchat.com on Unsplash

You may also like:

Top comments (10)

Collapse
 
coreybutler profile image
Corey Butler

FYI - the git shell isn't officially supported by NVM for Windows. Only terminal and powershell. I'm glad to know it works though.

Additionally, I think you've confused installing npm for installing node. NVM4W installs Node, which includes npm. When you run nvm install x.x.x or nvm use x.x.x, that's referring to Node, not npm.

Collapse
 
thomasmeschke profile image
Thomas Meschke

Hey Corey, thanks for sharing those information with us =)

I am running into the issue that installing a version is working fine, but when typing "nvm use 17.4.0" in my case, I get an "exit status 1: Access denied" error.

Anny clue what that might be? I am rather unsure if it would be smart to run the cmd as admin, or if I would then limit the use of node to the admin user somehow.

Collapse
 
coreybutler profile image
Corey Butler

Sorry for the late reply (I don't use this site very often). There's a guide for these kinds of errors at github.com/coreybutler/nvm-windows...

Collapse
 
steplerpaulo profile image
Paulo • Edited

*Open PowerShell (recommend opening with elevated Admin permissions).

Reference: docs.microsoft.com/en-us/windows/d...

Collapse
 
felipealbuquerq profile image
Felipe Albuquerque de Almeida

I've been using it for some time and I always recommend NVM to my colleagues. Your article was really cool and I think about creating a Portuguese version for the class here in Brazil that I always help in this process.

Collapse
 
coreybutler profile image
Corey Butler

I'm working on the NVM4W successor, called rt (stands for runtime). I don't have anything ready for public use yet, but it already supports langauge packs. When I finally reach a release point, I'll be looking for people to provide translations.

Collapse
 
ikeeptrying profile image
Dre

What is the reason for installing npm and then node, separately? I thought node includes npm automatically. There should not be a need to install npm at all. I think???

Collapse
 
dylajwright profile image
Dylan

Hey Dre,
If you see above Corey, whose the author of NVM provides some insight on your comment.

Collapse
 
mcapodici profile image
Martin Capodici

Thanks for these instructions! Gave me the confidence to give NVM a try on windows.

Collapse
 
jeltzcode profile image
JeltzCode

In which cases would you want to install an older version of NVM or NPM?