How to Use NVM (Node Version Manager) Like a Pro: Complete Guide for Developers

Learn how to use NVM (Node Version Manager) to install, switch, upgrade, and manage multiple Node.js versions efficiently. Complete beginner-friendly guide with practical examples.

What we do
  • WordPress Themes & Plugins
  • E-commerce, News Portals, Web Apps
  • Mobile & Desktop Applications
  • Professional IT Training Center
Published: 2026-06-16 15:39:22

Article

Managing multiple Node.js versions can become challenging when different projects require different environments. This is where NVM (Node Version Manager) becomes one of the most valuable tools for Node.js developers.

Quick Answer: NVM (Node Version Manager) allows developers to install, switch, upgrade, downgrade, and manage multiple Node.js versions on a single machine without conflicts.

What Is NVM?

NVM stands for Node Version Manager. It is a command-line tool that enables developers to install and manage multiple versions of Node.js on the same computer.

Instead of uninstalling and reinstalling Node.js every time a project requires a different version, NVM lets you switch versions instantly.

Example Scenario

Project A requires Node.js 18.
Project B requires Node.js 20.
Project C requires Node.js 22.

With NVM, switching between versions takes only a few seconds.

Why Every Node.js Developer Should Use NVM

  • Manage multiple Node.js versions
  • Test applications across versions
  • Avoid compatibility issues
  • Upgrade and downgrade safely
  • Keep development environments organized
  • Work on legacy and modern projects simultaneously

Install NVM on Windows

Windows users can install NVM for Windows.

  1. Download NVM for Windows.
  2. Run the installer.
  3. Complete the setup wizard.
  4. Restart Command Prompt or PowerShell.

Verify installation:

nvm version

Install NVM on Linux and macOS

Open Terminal and run:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

Reload terminal:

source ~/.bashrc

Verify installation:

nvm --version

Install a Node.js Version

Install the latest version:

nvm install node

Install the latest LTS version:

nvm install --lts

Install a specific version:

nvm install 20.18.0

View Installed Versions

nvm list

This command displays all Node.js versions currently installed on your machine.

Switch Between Versions

To use Node.js version 20:

nvm use 20

Verify active version:

node -v
NVM instantly switches Node.js versions without requiring reinstallation.

Set a Default Version

Configure a version that loads automatically whenever you open a terminal:

nvm alias default 20

Verify:

nvm current

Upgrade Node.js Using NVM

Install the newest LTS release:

nvm install --lts

Switch to the new version:

nvm use --lts

Downgrade Node.js Using NVM

Need an older version for a legacy project?

nvm install 18
nvm use 18

This makes downgrading safe and reversible.

Use .nvmrc for Team Projects

Professional development teams often create a file named:

.nvmrc

Example:

20.18.0

Developers can automatically switch versions:

nvm use
This ensures all developers use the same Node.js version across development, testing, and production environments.

Remove Unused Versions

Delete older versions you no longer need:

nvm uninstall 16

This helps free up disk space and keeps your environment organized.

Common NVM Commands

Command Purpose
nvm install node Install latest Node.js
nvm install --lts Install latest LTS
nvm list Show installed versions
nvm use 20 Switch version
nvm current Show active version
nvm uninstall 18 Remove version
nvm alias default 20 Set default version

Best Practices for Using NVM

  • Always use LTS versions in production.
  • Create .nvmrc files for projects.
  • Keep multiple versions only when necessary.
  • Test applications before upgrading.
  • Remove unused versions periodically.
  • Document required Node.js versions in project documentation.

Frequently Asked Questions

Yes. NVM is completely free and open-source.

Yes. This is one of the primary purposes of NVM.

NVM is primarily designed for development environments. Production servers typically use a fixed Node.js version.

Conclusion

NVM is one of the most useful tools in the Node.js ecosystem. Whether you're maintaining legacy applications, testing compatibility, or developing modern web applications, NVM makes Node.js version management simple and efficient.

By mastering NVM, you'll save time, avoid version conflicts, and maintain cleaner development environments across all your projects.

About ShasTech-IT

ShasTech-IT specializes in Node.js development, web application development, Android apps, ERP, HRMS, WMS, POS systems, e-commerce solutions, and custom business software development.

Contact WhatsApp