Install Node.js Using NVM
Learn how to install Node.js using NVM (Node Version Manager) on Linux in a few simple steps.
To install Node.js using NVM (Node Version Manager) on Linux, follow these steps:
Step 1: Install NVM
-
Open your terminal.
-
Run the following command to download and install NVM:
🔹 Replace
v0.39.7
with the latest NVM version from the NVM GitHub. -
Reload your shell configuration to apply changes:
-
Verify NVM installation:
If NVM is installed correctly, you’ll see its version number.
Step 2: Install Node.js Using NVM
-
List available Node.js versions:
-
Install the latest stable Node.js version:
OR, install a specific version (e.g., 20.14.0):
-
Verify the installation:
Step 3: Set Default Node.js Version
If you have multiple Node.js versions, set a default version:
Step 4: Check Installed Node.js Versions
List all installed Node.js versions:
Step 5: Uninstall Node.js (If Needed)
To remove a specific Node.js version:
Bonus: Install Yarn (Optional)
If you need Yarn (a package manager alternative to npm), install it with:
Verify with: