Change log

  • Added that NVM installation and NVM execution should be done with administrative privileges.

In this article, I will summarize the steps to change multiple Node.js versions depending on the project using NVM for Windows. I'll also describe how to deal with errors you may face if you already have Node.js installed, or if you installed NVM in C:\Program Files.

NVM for Windows and other Node.js version control tools

NVM is a management tool that allows you to switch between different versions of Node.js. There are other version control tools like this one, such as

  • NVM (!)
  • n
  • nodist

It's a bit complicated, but as explained in the NVM for Windows repository, NVM for Windows is a separate project from NVM, and is built on a completely different philosophy. The language is also different, written in GO.

Both NVM and n are Mac/Linux tools and cannot be used on Windows.

If you are using Windows, you can use NVM for Windows or nodist.

Installation Instructions

00. Prerequisite : Uninstall Node.js and NPM

If you already have Node.js and NPM installed, you will need to uninstall them.

In addition, if you still have the directory where Node.js was installed, you need to delete it. For example, directories such as C:\Program Files\nodejs (depending on your environment).

In addition, you should also remove the existing npm installation directory so that the globally installed Node modules do not conflict.

Normally, this would be the following directory ```C:\Users\\AppData\Roaming\npm``.

Take a backup just in case.

01. Downloading the installer

You can download the installer for the latest release from the following page.
Releases - coreybutler/nvm-windows

nvm-setup.zip is the installer.

For those who want to install it manually, a package nvm-noinstall.zip is distributed.

Here is the official installation procedure. Unzip the zip file, move it to the location where you want to install it, and then double-click install.cmd to set the environment variables.
Home - coreybutler/nvm-windows Wiki

02. Run the installer as administrator.

If you unzip the downloaded nvm-setup.zip, you will find nvm-setup.exe, run it as administrator.

*In some environments, it seems to install properly if you run it with administrator privileges.

03. Select the installation location and install.

By default, it will be C:\Users\{username}\AppData\Roaming. If you wish to change it, do so accordingly.

The only thing to keep in mind is to not choose a folder that contains spaces. If it contains spaces, you will get the following error when running NVM.

exit status 1: 'Destination directory' is not recognized as an internal or external command, operable program or batch file.

04. If you have a terminal running, close it and check if it is installed.

If you already have a terminal / command prompt / power shell running, close it and restart it.

Please make sure to run as administor.
Otherwise, you may get an error message access is denied when you try to check the version with node -v after installing Node.

Then type the following command, and if the version is displayed, you are done.

nvm version

usage of NVM

Install Node.js

Install Node.js with the following command.

nvm install 0.0.0

In the ``0.0.0``` section, specify the version.

You can also use the following to install the latest version.

nvm install latest

Check the installed version.

The following command will show you the list of installed Node.js versions.

nvm list

Use any version you want.

You can use the following command to specify any version.

nvm use 0.0.0

Once specified, you can check the node version with the node -v command.

When you can't install Node.js with NVM.

Maybe you can install it by running the command tool as administrator.

[Things tend to be forgotten] Linter needs to be reinstalled

If you've already installed Node.js and NPM and are using Linter, you'll need to install Linter with the respective Node.js version, since you've uninstalled/removed it before installing NVM.

This is something you might forget.

In the case of CSSLint and JSHint, you can install them globally with the following command.

For CSS linters

npm install -g csslint

For JSHint

npm install -g jshint

It is installed globally for use with code editors.

Reference articles

NVM for Windows Official Repository
coreybutler/nvm-windows: A node.js version management utility for Windows. Ironically written in Go.

An article that explains common errors in NVM for Windows.
PTQ | common issues when using nvm on Windows


Author Info
Profile Icon

Director of web and marketing

Kota Shimizu

I've been working in web, video, and magazine production fields, experienced planning, design, photography, coding, marketing, and business improvement. I'm an omnivorous director who can handle anything in a widely.