How to Use NVM-Windows to Manage Node.js Versions: A Step-by-Step Guide
Introduction
Working with different Node.js versions can be necessary when you're juggling multiple JavaScript projects. nvm-windows
provides a hassle-free way to switch between Node.js versions on Windows. Follow this step-by-step guide to take control of your Node.js environments.
Step 1: Install nvm-windows
Before you can manage Node.js versions, you need to install nvm-windows
:
- Go to the
nvm-windows
GitHub releases page. - Download the latest version of the
nvm-setup.zip
file. - Extract the contents and execute the
nvm-setup.exe
file. - Follow the installation instructions.
After installation, verify that nvm-windows
is installed by opening a command prompt or PowerShell and typing:
nvm version
Step 2: Install Node.js Versions
Install any version of Node.js using nvm-windows. For example, to install Node.js version 14.17.0, type:
nvm install 14.17.0
Replace 14.17.0 with the version number you require.
Step 3: List Node.js Versions
To see a list of all installed Node.js versions, enter:
nvm list
Step 4: Switch Node.js Versions
To switch to a different Node.js version, use:
nvm use 14.17.0
Ensure to change 14.17.0 to the version you want to activate.
Step 5: Set a Default Node.js Version
Set a default Node.js version that will be used automatically in new shells:
nvm alias default 14.17.0
Again, replace 14.17.0 with the version you wish to set as default.
Conclusion
nvm-windows is an invaluable tool for Windows-based developers working with Node.js. By following these steps, you can install, manage, and switch Node.js versions effortlessly.