DEV Community

Cover image for Seamlessly Manage Node.js Versions on Windows with nvm
Prateek kumar
Prateek kumar

Posted on

Seamlessly Manage Node.js Versions on Windows with nvm

As a developer, managing multiple versions of Node.js can be challenging, especially when different projects require different versions. Thankfully, nvm-windows (Node Version Manager for Windows) simplifies this process, allowing you to switch between Node.js versions effortlessly without the need for tedious installations or uninstallations.

What is nvm-windows?

nvm-windows is a command-line utility that lets you manage multiple installations of Node.js on a Windows machine. It enables you to switch between different Node.js versions easily, ensuring that your projects run on the appropriate version without any conflicts.

Installing nvm-windows

Follow these steps to install nvm-windows on your system:

  1. Download the installer: Visit the nvm-windows releases page and download the latest nvm-setup.zip file.

Image description

  1. Run the installer: Extract the downloaded zip file and run nvm-setup.exe. Follow the on-screen instructions to complete the installation.

Image description

  1. Verify the installation: Open a new Command Prompt window and type: nvm -v

Image description

Using nvm-windows

With nvm-windows installed, you can start managing your Node.js versions effortlessly.

Installing a Node.js Version

To install a specific version of Node.js, use the following command:

nvm install <version>
Enter fullscreen mode Exit fullscreen mode

Listing Installed Versions

To see a list of all installed Node.js versions, use:

nvm list
Enter fullscreen mode Exit fullscreen mode

Switching Between Versions

Switching between different Node.js versions is simple:

nvm use <version>
Enter fullscreen mode Exit fullscreen mode

Setting a Default Version

To set a default Node.js version that nvm-windows will use whenever a new terminal window is opened, use:

nvm alias default <version>
Enter fullscreen mode Exit fullscreen mode

Uninstalling a Node.js Version

If you no longer need a particular version of Node.js, you can uninstall it with:

nvm uninstall <version>
Enter fullscreen mode Exit fullscreen mode

Tips for Effective Use

  • Keep it updated: Regularly update nvm-windows and your Node.js versions to benefit from the latest features and security patches.
  • Project-specific versions: Utilize .nvmrc files in your projects to specify which Node.js version should be used. nvm use will read this file and switch to the specified version automatically.

By following these steps, you can efficiently manage multiple Node.js versions on your Windows machine, ensuring smooth development across different projects.

Top comments (0)