Different software development tools often require specific versions of Node.js and NPM (Node Package Manager). To effectively manage these versions and test NPM packages, it is essential to have Node Version Manager (NVM) installed. While NVM is primarily supported on Linux and Mac, Windows users can utilize “nvm-windows” to achieve similar functionality. In this blog post, we will explore how to download, install, and use NVM on Windows 10.
Table of Contents
1. How to Download and Install Node Version Manager in Windows 10
– Uninstalling Node.js and Yarn (if previously installed)
– Downloading nvm-windows
– Installing nvm-windows
– Verifying the installation
2. How to Use NVM on Windows 10
– Opening PowerShell or Command Prompt as an admin
– Using Git bash as an alternative
3. How to Install Different Versions of Node.js and NPM with NVM
– Installing the latest version of Node.js
– Installing the LTS version of Node.js
– Installing a specific version of Node.js
– Installing specific versions of NPM
4. Recap
– Summary of the steps covered in the article
1. How to Download and Install Node Version Manager in Windows 10
Before installing nvm-windows, it is recommended to uninstall any existing Node.js and Yarn installations to avoid conflicts. Once uninstalled, follow these steps to download and install nvm-windows:
Step 1: Visit the nvm-windows repository and click on “Download Now!”
Step 2: Choose the latest version (e.g., April 28, 2022) and download it.
Step 3: Locate the installer on your computer and run it to begin the installation.
Step 4: Open PowerShell or Command Prompt and verify the installation by running
nvm -v
.
2. How to Use NVM on Windows 10
To use NVM effectively, you need to open PowerShell or Command Prompt as an administrator. Alternatively, you can use Git bash. Here’s how to open them:
– Opening PowerShell as admin: Right-click on Start and select “PowerShell (Admin).”
– Opening Command Prompt as admin: Search for “cmd” and select “Open as Administrator” on the right.
3. How to Install Different Versions of Node.js and NPM with NVM
The real power of NVM lies in its ability to manage multiple Node.js versions on your Windows machine. Follow these steps to install and switch between different versions:
– Installing the latest version of Node.js: Run `nvm install latest`.
– Installing the LTS version of Node.js: Run `nvm install lts`.
– Installing a specific version of Node.js:
– Check the available versions by running `nvm list available`.
– Install the desired version using `nvm install node-version-number` (e.g., `nvm install 14.20.0`).
– Installing specific versions of NPM: If the desired NPM version is not available, run
npm install @npm version-number -g
to install it.
To view the list of installed Node versions, use
nvm list
. To use a specific version of Node, run
nvm use version
(e.g., `nvm use latest`, `nvm use lts`).
4. Recap
In this blog post, we covered the process of installing NVM (nvm-windows) on Windows 10 and how to utilize it to manage different versions of Node.js and NPM. The key commands you
‘ll use with nvm-windows are:
– `nvm install node-version` to install a specific Node.js version.
– `nvm list` to view installed Node.js versions.
– `nvm use node-version` to switch to a specific Node.js version.
Thank you for reading this guide on NVM for Windows. Enjoy coding and exploring different versions of Node.js on your Windows 10 machine!