How to Downgrade Node Version in Windows

May 25, 2023

Introduction

Developers use the Node.js runtime environment to build server-side and networking applications using JavaScript. To guarantee optimal performance and security, you need to update Node.js to the latest version regularly.

However, developers sometimes need to downgrade Node to a previous version when they encounter compatibility issues with dependencies or when a project requires a specific release.

Learn how to downgrade the Node version in Windows and manage multiple Node.js versions on a machine.

Developer attempting to downgrade Node.js.

Prerequisites

  • Access to the Windows command prompt (CMD) or PowerShell.
  • Administrator privileges.

Downgrade Node Version on Windows

Removing an existing Node distribution and reinstalling a previous version whenever you have a different project is impractical.

The nvm (Node Version Manager) tool enables developers to install different versions of Node side-by-side and switch between these versions via the Windows command line.

Note: Having two concurrent Node distributions, one installed using nvm and another using npm, may lead to compatibility issues. It is recommended to uninstall existing Node versions before installing nvm.

Step 1: Uninstall Existing Node Version

To remove a Node.js version from your Windows system:

1. Type Control Panel in the search box on the taskbar.

2. Open the Control Panel app.

Access Control Panel in Windows.

3. Click Uninstall a program in the Programs category.

Uninstall Node app in Windows.

4. Select the Node.js installation.

5. Click Uninstall.

Steps to uninstall Node in Windows.

The Windows Installer proceeds to uninstall Node.js. Follow on-screen prompts to ensure the process runs its course and that the current Node.js version is completely removed from your Windows system.

Step 2: Install nvm on Windows

To install nvm on Windows:

1. Use a browser to access the nvm GitHub repository.

2. Download the latest nvm installer by clicking nvm-setup.exe in the Assets section.

Downloading the nvm installer from GitHub.

3. Locate the installer on your local machine and double-click to start the installation.

Initiate the nvm installation process.

4. Select I accept the agreement.

5. Click Next.

Accept nvm license agreement.

6. Choose an nvm installation path and select Next.

Set the nvm installation path.

7. Keep the default path or define a custom symlink for the active Node.js version.

8. Click Next.

Set the Node.js symlink path.

9. Select Install.

Install nvm on Windows.

10. Click Finish.

Finish nvm installation process on Windows.

The nvm installation process is complete.

Step 3: Use nvm to Install Node

Managing Node.js versions via nvm requires administrator privileges for the Windows command prompt (CMD) or PowerShell.

To install a specific Node version using cmd:

1. Type cmd in the search bar and select Run as administrator.

Open Windows cmd as an administrator.

2. List the available Node versions using the following command:

nvm list available
A list of available Node.js versions.

Identify the version you want to install and note the version number.

3. To install a specific version, use the following command (replace x.x.x with the version number):

nvm install x.x.x

For example, to install Node.js version 16.14.1, type:

nvm install 16.14.1
Install specific Node version using nvm.

The system confirms that the installation is complete.

To install the latest available Node version, enter:

nvm install latest
Installing the latest Node version on Widows.

Note: Every time you use nvm to install a new Node.js version, the tool also installs the corresponding npm version by default.

To install the latest stable version, which is recommended for most users, type:

nvm install lts
Installing the latest stable Node.js version using nvm.

To start using the lts version, enter the following command:

nvm use lts
Start using the Node lts version in Windows.

The system confirms the Node version currently being used.

Step 4: Downgrade Node Version

To downgrade a Node version, type the following command::

nvm use x.x.x

Replace x.x.x with a version number.

Note: Ensure that the version you want to use is already installed.

For example, to start using a previously installed version, 16.14.1, enter:

nvm use 16.14.1
Using nvm to downgrade Node.js version in Windows.

You have successfully downgraded the Node.js version on Windows using nvm.

Step 5: Check Current Node Version

To verify the system is using the correct Node version, run the following command:

node -v
Check Node version using the Windows cmd.

The version number is shown in the terminal.

To confirm the npm version, type:

npm -v
Check npm version in Windows using the command prompt.

The system displays the npm version.

How to Switch Between Node Versions

Before switching between Node versions, list the versions installed on your Windows machine.

1. Use the following command to list installed Node versions:

nvm list

2. Switch to a different Node version from the list. For example:

nvm use 20.2.0

3. List installed Node versions again to confirm the correct version is actively used:

nvm list
Steps to switch between Node versions in Windows.

The asterisk (*) symbol shows which Node.js version the system currently uses.

Conclusion

Now you know how to downgrade and manage Node.js versions on Windows using the nvm tool.

Use this knowledge to quickly switch between Node versions based on project requirements and avoid potential compatibility issues.

Was this article helpful?
YesNo
Vladimir Kaplarevic
Vladimir is a resident Tech Writer at phoenixNAP. He has more than 7 years of experience in implementing e-commerce and online payment solutions with various global IT services providers. His articles aim to instill a passion for innovative technologies in others by providing practical advice and using an engaging writing style.
Next you should read
Install Chocolatey on Windows 10
August 25, 2022

Chocolatey is an open-source package manager designed for Windows. This tutorial shows how to install and use Chocolatey with some basic commands.
Read more
How to Install Yarn on Windows
October 14, 2021

Yarn is a tool for managing, updating, and sharing your Java code. It works through node.js, and it helps to track libraries, dependencies, and even to share solutions with other developers. In this tutorial, learn how to install
Read more
How to Install Maven on Windows
February 17, 2022

Apache Maven is a project management tool for developing Java applications. This tutorial shows you how to install Maven on Windows.
Read more
Yarn vs NPM: A Comprehensive Comparison
November 4, 2021

Yarn and NPM are among the most popular package managers for Node.js. This articles compares and contrasts their features to help you determine which you should choose.
Read more