Carl Rippon

Building SPAs

Carl Rippon
BlogBooks / CoursesAbout
This site uses cookies. Click here to find out more

Using Multiple Versions of Node on Windows

July 08, 2020
nodejavascript

Often, the projects that we are working on may use different versions of node. So, we may need to switch our node version every so often. Luckily, there is a more efficient way of doing this than manually uninstalling and reinstalling node each time we need to switch.

In this post, we will cover how to switch node versions on Windows using NVM for Windows.

Installing NVM for Windows

First, any versions of node that we have installed need to be uninstalled. This is because we will be using NVM to install and manage the versions of node we require.

The windows installer for NVM can be found here. Simply download and run the installer.

The installer will place NVM in an appropriate folder on your machine and update your system environment variables so that NVM and future installations of node are available on the command line.

Further details on installing NVM for Windows can be found here.

To check that NVM has been installed successfully, enter the following in a Terminal window:

nvm -v

If an error occurs, then NVM isn’t installed properly.

Adding versions of node to NVM

To add a node version to NVM, enter the following in a Terminal window:

nvm install version-number

e.g.

nvm install 8.17.0

To install the latest version of node, we can use latest as the version:

nvm install latest

The nvm install command can be used to install all the versions of node we require.

The nvm list command shows the node versions that are available with NVM:

nvm list

nvm list

Notice the * symbol. This indicates the current version of node.

Switching to a version of node

To switch to a specific version of node we use the nvm use command:

nvm use version-number

e.g.

nvm use 8.1.7.0

Our node project will then use this version of node.

We can double check that this is the case by running the following command:

node -v

node version

Wrap up

NVM for Windows allows us to switch between versions of node efficiently. First, we install the node versions we need to work with into NVM using nvm install. We then use nvm use to switch to a specific version of node.

Want more content like this?

Subscribe to receive notifications on new blog posts and courses

Required
© Carl Rippon
Privacy Policy