DEV Community

Cover image for How to Install NVM in Windows
OpenReplay Tech Blog
OpenReplay Tech Blog

Posted on

How to Install NVM in Windows

Node Version Manager (NVM) is a handy tool for managing multiple Node.js versions. While NVM was initially designed for Unix-based systems, a Windows-compatible version, nvm-windows, is available. This guide will show you how to install nvm-windows step-by-step.

Key Takeaways

  • nvm-windows makes it easy to manage multiple Node.js versions on Windows.
  • Installation requires downloading the correct package and configuring your environment.
  • Follow these steps to set up and verify your installation successfully.

Prerequisites

Before installing nvm-windows, ensure you have the following:

  • A Windows machine running Windows 10 or higher.
  • Administrator access to install programs.
  • No existing Node.js installation (uninstall if already installed).

Step 1: Download the NVM-Windows Installer

  1. Visit the official nvm-windows GitHub page.
  2. Scroll to the latest release and download the nvm-setup.exe file.

Step 2: Run the Installer

  1. Locate the downloaded nvm-setup.exe file and double-click it.
  2. Follow the installation wizard:
    • Accept the license agreement.
    • Choose the installation directory (default is C:\Program Files\nvm).
    • Specify a directory for Node.js installations (default is C:\Program Files\nodejs).

Step 3: Verify the Installation

After installation, verify that nvm-windows was installed correctly:

  1. Open a new Command Prompt or PowerShell window.
  2. Type the following command:
   nvm version
Enter fullscreen mode Exit fullscreen mode

You should see the installed nvm version. If the command is not recognized, ensure the installation directory is in your system's PATH environment variable.

Step 4: Install and Use Node.js Versions

With nvm-windows installed, you can now install and manage Node.js versions:

  1. Install a specific Node.js version (e.g., 16.14.0):
   nvm install 16.14.0
Enter fullscreen mode Exit fullscreen mode
  1. Switch to the installed version:
   nvm use 16.14.0
Enter fullscreen mode Exit fullscreen mode
  1. Verify the active Node.js version:
   node -v
Enter fullscreen mode Exit fullscreen mode

FAQs

What if 'nvm' is not recognized after installation?
Ensure the NVM installation directory is added to your system's PATH variable. Reopen Command Prompt or PowerShell after fixing it.

Can I install both NVM and Node.js manually on Windows?
It's not recommended. Uninstall any pre-existing Node.js version before using nvm-windows to avoid conflicts.

Is nvm-windows compatible with WSL?
No, nvm-windows works in native Windows environments. For WSL, use the original NVM for Unix systems.

Conclusion

Installing nvm-windows is a straightforward process that simplifies managing multiple Node.js versions. Follow the steps above to install, verify, and start using it effectively for your projects.

Top comments (0)