In this article, I’ll describe how to install and Use NVM (Node Version Manager) on Windows, Linux, and Mac.
Designers of Node.js applications may need to use different versions. Node Version Manager makes installing and managing them all on one workstation easy. This guide covers all the commands needed to switch Node versions easily. Node.js Version Manager (nvm) allows installing and managing various versions locally. Even if you only need one version of Node.js, we recommend using nvm because it makes switching between versions easy.
What is NVM?
Node Version Manager (NVM) manages Node versions on your device. Projects on your smartphone may use different Node versions. Using simply the installed version for these projects may deliver inaccurate execution results. For instance, using Node 10.0.0 for a 12.0.0 project may cause issues. You may not obtain the desired result if you update Node to 12.0.0 via npm and use it for a 10.0.0 project. You would likely receive a warning stating:
This project needs Node X.
Instead of using npm to install and remove Node versions for each project, use nvm. NVM lets you install different Node versions. Depending on the project, it also switches between them via the command line. The next sections will explain installing NVM on Windows, Linux, or Mac. If you have Node.js installed, uninstall it before proceeding to avoid any problem with nvm.
How to Install NVM on Windows
NVM usually works on Linux and Mac. Windows isn’t supported. However, Coreybutler’s nvm-windows provide a nvm experience in Windows. Nvm-windows manage Windows Node.js versions.
We aren’t in favor of installing Node.js with nvm in production. Use your O.S.’s package manager or server tooling to install and lock down Node.js in your production environment. The project’s README contains official NVM installation instructions and troubleshooting recommendations.
How to install it:
1. Press the download now
In the nvm-windows repository Readme, press “Download Now!”

This opens a page with NVM releases.
2. Installing the .exe file of the updated version
Different assets are in the newest release (1.1.9). Click the tool’s installation file, nvm-setup.exe:

3. Finish the installation Wizard.
Complete the installation wizard in the downloaded file. When done, run to verify the nvm installation.
nvm -v
If nvm is properly installed, this command will display its version.
Installing NVM on Mac and Linux
You can install nvm on Linux and Mac similarly because they are both UNIX-based OSes.
1. Run the installer of NVM.
Use your terminal to execute the NVM installer:
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
Depending on your device, use curl or bash. These commands clone the nvm repository to ~/.nvm on your device.
2. Updating your profile settings
The step 1 installation should immediately add the nvm configuration to your profile. To use zsh, navigate to ~/.zshrc. If using bash, use ~/.bash_profile or another profile. You can add nvm configuration to your profile file if it doesn’t automatically:
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”
Use this command to load nvm
3. Reload the shell configuration
Now that your profile configuration is updated reload your terminal configuration:
Source ~/.bashrc
With this command, nvm is ready to use. Run: to verify NVM installation.
nvm –v
This shows the installed nvm version. You can uninstall, install, and switch between Node versions on Windows, Linux, or Mac with nvm. Node versions can be installed:
Nvm install latest
The last Node version is installed with this command:
nvm install vX.Y.Z
Installs X.Y.Z. Node! Run: to make a version your default.
nvm alias default vX.Y.Z
Run this in your terminal to access specific versions at any time:
nvm use vA.B.C
Node.js NVM simplifies managing numerous versions across projects that need different versions.
How to use Node Version Manager
There are a few things to know to utilize Node Version Manager efficiently. These concepts are discussed below with examples of how to complete different tasks.
Widely used npm packages
Globally installed npm packages aren’t shared between Node.js versions due to incompatibility. Every time you install Node.js, Node Version Manager installs a suitable version of npm. Run npm -v to see which npm version is currently in use, as each Node instance may have its own. On the plus side, installing global packages doesn’t require sudo. Reinstalling npm global packages for a certain version of Node.js while installing a new version is possible:
nvm install v6.5.0 –reinstall-packages-from=4.2
The above program installs version 6.5.0 and its npm version before reinstalling any 4.2-installed npm packages.
Adding the iojs-v prefix installs io.js instances, but specifying the version number always affects Node.js. Run: to install io.js 3.2.0.
nvm install iojs-v3.2.0
Aliases
To simplify things, Node Version Manager allows you to target versions without version numbers using aliases. Aliases include:
- Node: Installs the latest stable version of Node.js
- Unstable: Installs the latest unstable version.
- Io.js: installed the latest stable version of io.js
If you need the most recent version of Node.js, run:
Nvm install Node
For Default alias, Run to set the newest Node.js as your default.
nvm alias default node
The following format lets you create your aliases:
Nvm alias my-favorite 6.5.0
For version 6.5.0, the above command creates my favorite. You can switch to 6.5.0 later:
Nvm use my-favorite
To permanently delete this alias, enter:
No alias my-favorite
Switching between Node.js versions
New versions of Node.js are automatically installed. Use the command nvm use to swap versions, which works like install. Just add a version or alias. If you wish to upgrade Node.js, run the following:
Nvm use node
Run to see your Node.js versions and aliases:
nvm ls
The current version will be green with an arrow, whereas the others will be blue. You can also run the following command to determine your version:
nvm current
Additional commands
Other commands may be useful occasionally. Use the following format to run an installed version command without altering node variables:
nvm 6.5.0 –version
Use this format to target a certain version when running a subshell command:
NVM exec 6.5.0 node –version
Use this format to view the path to a certain version of Node.js:
nvm which 6.5.0
Create.nvmrc files in project directories to specify Node.js versions for specific projects. Avn, a shell plugin, automatically invokes Version Manager when you move directories. It allows deep integration.
Troubleshooting
If a Node installation fails, remove the downloads from src. Otherwise, retrying may get an error. If your system is incompatible with the official binary packages, try installing from the source with the -s option. To install version 6.5.0, run:
nvm install -s 6.5.0
If the Version Manager command line is unavailable after setting up OS X, you may be without a.bash_profile file. Run the following command before running the installer script to fix this:
touch ~/.bash_profile
If problems persist, open the.bash_profile file in your text editor and add this line:
source ~/.bashrc
The advantages of Node Version Manager
Switching Node versions saves time and effort and has other benefits. Let’s imagine a tool supports one version of Node.js, but you wish to test it with another. To fix issues, Version Manager lets you swap node versions quickly. Without it, you’d have to uninstall and reload node versions and global packages to switch.
Node Version Manager helps you avoid update barriers if you’re utilizing a developer preview tool. When SharePoint Framework was in preview, each drop had a new Yeoman generator. Thus, you could work locally with the newest developer preview but have to wait days or weeks for Office 365’s supported libraries, or you could delay installation. Node Version Manager makes it easy to maintain previous and new generator versions.
Version Manager makes storing and saving pre-release tools from DevKitchen or workshops easy. You can go to a new Node.js setup, work in it, and save it instead of using your primary install. That way, you can easily access those tools later if unavailable elsewhere.
Want to read about Pokemon nature?
Conclusion:
The development team values time; learning Node Version Manager (NVM) can save you a lot. Keep this tutorial available for refreshers, but with such a small learning curve, you’ll likely remember the commands soon.
FAQ
How to install npm using nvm?
Run the terminal command nvm list available to get a list of Node versions which is available for download and installation. For using a certain Node version, run nvm use 16.9.1 then enter the version number.
How does Windows Node version management install Node?
After downloading, open the zip file and nvm-setup.exe. The Setup-NVM-for-Windows wizard will let you choose the directory for nvm-windows and Node. js. Install the latest stable LTS Node.
How to change node version with nvm?
- Update npm: Update NPM using this command: install -g npm…
- Install the newest node version with this command.
- Check all system node versions: #nvm ls.
- Specific version #nvm usage.
- Install the latest npm: # install npm -g.
How to install npm?
- Import the disk-based node_modules tree.
- Clone the tree.
- Get the package.add json and information to the clone.
- Navigate the clone and add dependencies.
- Requirements will be created as high as possible.