Introduction

NVM (Node Version Manager) is a tool that allows you to manage multiple versions of Node.js on your system. This guide will walk you through the process of installing and using NVM to manage Node.js versions.

Prerequisites

Before you begin, ensure you have:

  1. A Linux system (such as Ubuntu, Debian, CentOS, etc.)
  2. Basic knowledge of the command line

Step 1: Install NVM

Download the NVM installation script using cURL or Wget:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

Close and reopen your terminal to start using NVM.

Step 2: Install Node.js with NVM

Install the desired version of Node.js using NVM:

nvm install 

Replace <version> with the desired Node.js version (e.g., 14.17.6).

Step 3: Use Node.js Version

Switch to the installed Node.js version:

nvm use 

Step 4: Set Default Node.js Version

Set a default Node.js version to be used in new shell sessions:

nvm alias default 

Step 5: List Installed Node.js Versions

List all installed Node.js versions:

nvm ls

Step 6: Remove Node.js Version

Remove an installed Node.js version:

nvm uninstall 

Conclusion

Congratulations! You have successfully learned how to manage multiple Node.js versions using NVM (Node Version Manager). You can now switch between different Node.js versions and manage them easily on your system.

Was this answer helpful? 0 Users Found This Useful (0 Votes)