Install Node.js and npm with NVM on Ubuntu (Beginner-Friendly Guide)
Learn how to install Node.js and npm using NVM on Ubuntu. This guide covers installing NVM, managing multiple Node.js versions, setting a default, and updating with ease.

🚀 1. What Is NVM and Why Use It?
NVM (Node Version Manager) lets you install and manage multiple versions of Node.js on a single system. It's perfect for developers juggling projects with different Node requirements.
📦 2. Install NVM on Ubuntu
Step 1: Download and run the install script
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash Step 2: Load NVM into your terminal
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" Tip: To make NVM load automatically, add the above block to your ~/.bashrc, ~/.zshrc, or ~/.profile.
Step 3: Verify installation
nvm --version 📥 3. Install Node.js Using NVM
List available Node.js versions:
nvm ls-remote Install the latest LTS version:
nvm install --lts Or install a specific version:
nvm install 18.19.0 Verify installation:
node -v npm -v ⚙️ 4. Set a Default Node.js Version
Set a default Node version globally:
nvm alias default 18.19.0 From now on, every new terminal session will use this version unless overridden.
🔄 5. Switch Between Versions Easily
If you have multiple versions installed:
nvm use 16.20.0 To list all installed versions:
nvm ls đź§ą 6. Uninstall a Node.js Version
To remove a version you no longer need:
nvm uninstall 16.20.0 📎 7. Where Is npm Installed?
npm is automatically installed with Node.js via NVM. Check versions:
which node which npm They will typically point to paths like:
~/.nvm/versions/node/v18.19.0/bin/node âś… Conclusion
Using NVM on Ubuntu keeps your Node.js environment clean, flexible, and up to date. You can switch Node versions per project, test backward compatibility, or quickly adopt new releases—all without affecting your global system setup.
Share this article
Admin User
Admin User
Related Posts

How to Set Up Redis in Node.js on Ubuntu 20.04/22.04/24.04 LTS
Learn how to install and configure Redis with Node.js on Ubuntu 20.04, 22.04, or 24.04 LTS. This step-by-step guide ensures high-performance caching and data storage for your Node.js apps.

The Enduring Importance of Data Structures & Algorithms
In an age where AI seems to handle everything from chatbots to complex simulations, the fundamentals of Data Structures & Algorithms (DSA) remain the cornerstone of every efficient, scalable, and innovative software solution. Here’s why, even in 2025, DSA skills are non-negotiable for any developer aiming to thrive.

Average Salaries in India (2025) for Developers & Designers Based on Experience
Planning a career in tech or design? This detailed guide breaks down the average salary in India for developers (Node.js, Java, Python, Django) and designers based on experience—from fresher to 4+ years.

Ubuntu 24.04 LTS Installation Guide for Any PC – From BIOS to Developer Setup
Want to install Ubuntu 24.04 LTS on your PC? This universal guide covers BIOS setup, swap memory recommendations, partitioning, and essential post-install commands for all systems.
