How to Switch Node Version on Windows

Feb 13, 2024

2 mins read

Published in
---

How to Switch Node.js Versions in Windows

Node.js is a powerful runtime environment for executing JavaScript code server-side. As projects evolve, you might need to switch between different Node.js versions to ensure compatibility or take advantage of new features. This blog will guide you through the process of switching Node.js versions on a Windows operating system.

Prerequisites: Before we begin, ensure that you have Node Version Manager (NVM) installed on your Windows machine. NVM allows you to manage multiple Node.js versions effortlessly.

Step 1: Install Node Version Manager (NVM)

  1. Visit the NVM repository on GitHub: https://github.com/coreybutler/nvm-windows
  2. Download the latest installer for Windows.
  3. Run the installer and follow the on-screen instructions to complete the installation.

Step 2: Verify NVM Installation

  1. Open Command Prompt by pressing Win + R, typing “cmd,” and hitting Enter.
  2. Type the following command and press Enter:
    nvm --version
    
    This should display the installed version of NVM, confirming that it’s properly installed on your system.

Step 3: Install Node.js Versions

  1. Open Command Prompt.
  2. To install a specific Node.js version, use the following command:
    nvm install <version>
    
    Replace <version> with the desired Node.js version (e.g., 14.17.0).
  3. Wait for the installation to complete. NVM will automatically set the installed version as the default.

Step 4: Switching Node.js Versions

  1. To list all installed Node.js versions, run:
    nvm list
    
    This will display a list of installed Node.js versions along with the currently active version.
  2. To switch to a different Node.js version, run:
    nvm use <version>
    
    Replace <version> with the desired Node.js version from the list.
  3. After running the command, verify that the Node.js version has been switched by running:
    node --version
    

By following these simple steps, you can easily switch between different Node.js versions on your Windows machine using Node Version Manager (NVM). Whether you need to test compatibility or leverage new features, NVM makes managing Node.js versions a breeze.

Sharing is caring!