NVM: The Tool That Makes Node.js Version Management Easy

During my software engineering journey at ALX SE, I ran into a common problem. A project required Node.js version 12, but I had version 14 installed on my computer. Instead of uninstalling and reinstalling Node.js, I discovered NVM — a simple tool that solved this problem perfectly.
What is NVM?
NVM is simply a tool that lets you install and use different versions of Node.js on your computer. NVM lets you switch between Node.js versions with a simple command.
Why You Might Need It
You’ll need NVM when:
• A project requires a specific Node.js version
• You want to test your code in different Node.js versions
• You work on multiple projects that use different Node.js versions
Installation Guide
Important: Before installing NVM, uninstall any existing Node.js from your computer to avoid conflicts.
For Windows Users:
1. Go to the nvm-windows releases page: https://github.com/coreybutler/nvm-windows/releases
2. Download the Latest Version:
• Look for nvm-setup.exe under the latest release
• Click to download it
3. Install NVM:
• Run the downloaded nvm-setup.exe
• Follow the installation wizard
• Accept the default locations when asked
4. Verify Installation:
• Open a new Command Prompt as Administrator
• Type: nvm version
• If you see a version number, installation was successful
For Mac and Linux Users:
1. Open your terminal
2. Install NVM by running this command:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Or if you prefer wget:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
3. Close and reopen your terminal
4. Verify installation by typing:
nvm version
Using NVM: The Basics
Here are the commands you’ll use most often:
To install a specific Node.js version:
nvm install 14.17.0
To use a specific version:
nvm use 14.17.0
To see all installed versions:
nvm list
To install the latest version:
nvm install latest
Common Problems and Solutions
1. “nvm is not recognized”:
• Windows: Restart your Command Prompt as Administrator
• Mac/Linux: Restart your terminal
2. Installation fails:
• Make sure you’ve uninstalled Node.js first
• Run the installer as Administrator (Windows)
• Check your internet connection
3. Can’t switch versions:
• Use Administrator/sudo privileges
• Make sure you installed the version first
Wrap Up
NVM makes managing Node.js versions simple. Instead of the hassle of uninstalling and reinstalling Node.js every time you need a different version, you can switch versions with just one command.
Thank you for reading! happy coding.