# Guide to Installing Node.js via NVM on Windows, Linux, and Mac
Table of Contents
Node.js is an open-source platform used to build web applications, servers, and real-time apps. It is written in JavaScript, the programming language primarily used in web applications.
NVM stands for Node.js Version Manager, a tool that helps you manage multiple Node.js versions on the same system. This is useful when you need different Node.js versions for different projects.
In this article, we will walk through installing Node.js via NVM on every environment: Windows, Linux, and Mac.
Install NVM on Windows
You can install nvm on Windows through choco (learn about choco if you have not used it before). Open an elevated PowerShell window, then run:
# Install Chocolateychoco install nvm
# Restart PowerShellRestart-PowershellAfter restarting PowerShell, verify that NVM installed successfully with:
nvm --versionIf the command returns a version number, you are all set.
Install NVM on Linux
To install NVM on Linux, open a terminal and run:
# Install curl if it is missingsudo apt install curl
# Install NVM via curlcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashAfter installation, check that NVM is available:
nvm --versionIf the command returns a version number, the installation worked.
Install NVM on Mac
To install NVM on macOS, open a terminal and run:
# Install Homebrew if you do not have it/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# Install NVMbrew install nvmAfter installation, verify NVM with:
nvm --versionIf you see a version number, the setup is complete.
Install Node.js via NVM
Install Node.js through NVM with:
nvm install [version]For example, to install Node.js 16.13.0:
nvm install 16.13.0After installation, activate that version:
nvm use [version]For example, to switch to Node.js 16.13.0:
nvm use 16.13.0Conclusion
NVM is a handy tool that lets you manage multiple Node.js versions on the same system. With it, you can install, switch, and manage any version you need.
Additional NVM commands
Beyond the basic commands above, NVM offers extra commands that make version management easier. Common ones include:
nvm listto show every Node.js version currently installed.nvm ls-remoteto list every Node.js version available for installation.nvm uninstall [version]to remove a Node.js version.nvm alias [alias] [version]to create an alias for a Node.js version.
You can learn more on the official NVM repository (https://github.com/nvm-sh/nvm).