A Comprehensive Guide to Installing and Using NVM


Node Version Manager (NVM) is a powerful tool designed to help developers manage multiple Node.js versions on their devices. In this comprehensive guide, we’ll walk you through the steps to install and use NVM on various operating systems, including Windows, Linux, and macOS. By the end of this article, you’ll be equipped with the knowledge and skills to effectively manage Node.js versions across your different projects.

What is NVM and Why Do You Need It?

Node Version Manager (NVM) is a command-line tool that allows developers to install, manage, and switch between different Node.js versions with ease. As a developer, you might encounter situations where different projects require different Node.js versions due to compatibility issues or specific dependencies. Manually managing these versions can be time-consuming and error-prone.

NVM simplifies this process by providing an efficient way to manage multiple Node.js versions on a single device. With NVM, you can quickly switch between Node.js versions depending on the project you’re working on, ensuring compatibility and reducing the risk of encountering errors due to version mismatches.

Installing NVM on Windows

Although NVM was originally designed for Linux and macOS, a Windows version called nvm-windows is available for Windows users. Developed by Corey Butler, nvm-windows provides a similar experience to the original NVM tool. Here’s how to install nvm-windows on your device:

Download nvm-windows

  1. Visit the nvm-windows GitHub repository.
  2. Click on “Download Now!” in the repository’s README section.
  3. This will direct you to the releases page, where you can find the latest version of nvm-windows.

Install the nvm-setup.exe file

  1. Locate the nvm-setup.exe file in the assets section of the latest release.
  2. Click on the file to download it.
  3. Once downloaded, run the nvm-setup.exe file and follow the steps in the installation wizard.

Verify the installation

  1. Open a command prompt or PowerShell window.
  2. Type the following command and press Enter:
nvm -v
  1. If nvm-windows is installed correctly, the command will display the version number of the installed nvm-windows.

Installing NVM on Linux and macOS

For Linux and macOS users, the installation process is quite similar. Follow these steps to install NVM on your device:

Run the NVM installer script

  1. Open a terminal window.
  2. Run one of the following commands, depending on the tools available on your device:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

# or

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

These commands will clone the NVM repository to the ~/.nvm directory on your device.

Update the shell configuration

The installer script should automatically add the NVM configuration to your shell profile file (e.g., ~/.zshrc for Zsh or ~/.bash_profile for Bash). However, if it doesn’t, you can manually add the configuration by appending the following lines to your profile file:

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

Reload the shell configuration

  1. After updating your profile file, reload the shell configuration by running the following command in your terminal:
source ~/.bashrc
  1. Verify that NVM is installed correctly by running:
nvm -v

This command should display the version number of the installed NVM tool.

Basic NVM Commands and Usage

Now that you have NVM installed on your device, let’s explore some basic commands and usage patterns. Here are a few common commands you’ll use when working with NVM:

  • nvm install {version}: Install a specific version of Node.js.
  • nvm use {version}: Switch to a specific Node.js version.
  • nvm ls: List all installed Node.js versions.
  • nvm current: Display the current active Node.js version.
  • nvm alias {alias} {version}: Create an alias for a specific Node.js version.
  • nvm unalias {alias}: Remove an alias.
  • nvm uninstall {version}: Uninstall a specific Node.js version.

Installing Specific Node.js Versions

To install a specific Node.js version, use the nvm install command followed by the version number. For example, to install Node.js version 14.18.0, run the following command:

nvm install 14.18.0

NVM also allows you to install the latest Node.js version by using the latest keyword:

nvm install latest

You can also install the latest LTS (Long Term Support) version by using the --lts flag:

nvm install --lts

Switching Between Node.js Versions

To switch between installed Node.js versions, use the nvm use command followed by the version number or alias. For example, to switch to Node.js version 14.18.0, run the following command:

nvm use 14.18.0

If you have created an alias for a specific Node.js version, you can use the alias instead of the version number:

nvm use my-alias

Setting a Default Node.js Version

You can set a default Node.js version that will be used every time you open a new terminal session. To do this, use the nvm alias command followed by the default keyword and the version number or alias. For example, to set Node.js version 14.18.0 as the default version, run the following command:

nvm alias default 14.18.0

Uninstalling Node.js Versions

If you need to uninstall a specific Node.js version, use the nvm uninstall command followed by the version number or alias. For example, to uninstall Node.js version 14.18.0, run the following command:

nvm uninstall 14.18.0

Updating NVM

To update NVM to the latest version, you can use the same installation commands you used earlier. For example, on Linux or macOS, run the following command:

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

This command will update NVM to the latest version while preserving your installed Node.js versions and aliases.


NVM is an essential tool for developers who work with multiple Node.js projects requiring different Node.js versions. With NVM, you can easily manage and switch between Node.js versions, ensuring compatibility and reducing errors due to version mismatches. By following this comprehensive guide, you should now have a solid understanding of how to install and use NVM on your Windows, Linux, or macOS device.

Now that’s another tip! Hope it helps somehow. Let me know if you have questions or just leave a comment if we missed something.

Happy SharePointing! #SharingIsCaring

Accounting.js Automation Collaboration Competitors Connect Content Type Design Expand Flows Hillbilly Tabs Issues Javascript Limitation Limitations Microsoft Teams ModernScriptEditor NodeJs Node Versioning Numeral.js O365 Office 365 OneDrive Out Of The Box PnP Power Automate PowerShell Pwermissions Rest Endpoint ScriptEditor Send an HTTP Request to SharePoint SharePoint SharePoint Architecture SharePoint Designs SharePoint Modern SharePoint Online SharePoint Tabs ShellScript SPFX SPO Sync Teams Transform JS TypeScript Versioning Workflows

Leave a Comment

Your email address will not be published. Required fields are marked *