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.
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).
- Unzip/Extract the contents to the same folder.
- You should have the file nvm-setup.exe extracted in the same folder.
Install NVM
Double-Click on the executable file to launch the installer.
Choose 'I accept the agreement' option.
- Select destination to install.
- Select Symlink for Node.js.
- Click on Install & once it completes, click on the 'Finish' button.
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
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
- Let us install the latest version of npm. (As of Sep 2020)
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
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
Install Another npm Version
- Repeat the above steps
- Install Completed & Select the version using the 'nvm use' command
- Confirm that the environment now points to the new Node.js and npm versions
List all Versions
- You can use the nvm list command to list all the npm and Node.js versions installed.
$ nvm list
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
Top comments (10)
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
ornvm use x.x.x
, that's referring to Node, not npm.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.
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...
*Open PowerShell (recommend opening with elevated Admin permissions).
Reference: docs.microsoft.com/en-us/windows/d...
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.
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.
Thanks for these instructions! Gave me the confidence to give NVM a try on windows.
In which cases would you want to install an older version of NVM or NPM?
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???
Hey Dre,
If you see above Corey, whose the author of NVM provides some insight on your comment.