How to Install NVM on Ubuntu 24.04 or 22.04 Linux

Do you love working with Node.js? Then you’ll love NVM — the Node Version Manager. It lets you install, switch, and manage multiple versions of Node.js easily. Best of all? It makes your life a lot simpler!

Today, we’ll walk through a fun and easy way to install NVM on Ubuntu 24.04 and Ubuntu 22.04. Don’t worry if you’re new — we’ll keep things light!

🎯 Why Use NVM?

  • You can install multiple versions of Node.js.
  • You can switch between them anytime.
  • No more weird version mismatches in different projects!
Read also :   The Best Card Games You Can Find Online

Let’s dive in!

🔧 Step 1: Open Your Terminal

Click that Terminal icon or hit Ctrl + Alt + T. We’re going on a mission!

📥 Step 2: Install curl or wget

We’ll need curl or wget to fetch the NVM installer. Don’t worry if you already have them.

To install curl just in case:

sudo apt update
sudo apt install curl -y

Or if you prefer wget:

sudo apt update
sudo apt install wget -y

⚡ Step 3: Download the NVM Installer

Now we’ll grab the install script from GitHub. Use either command below:

With curl:

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

With wget:

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

This script:

  • Clones NVM to your home directory
  • Edits your shell startup file
Read also :   5 Groundbreaking Technologies Revolutionizing Tattoos

Nice and automatic!

📂 Step 4: Activate NVM

You’re halfway there! Just one more quick jump.

Reload the shell so you get NVM in your session:

source ~/.bashrc

Or, if you’re using zsh:

source ~/.zshrc

✅ Step 5: Confirm It Works

Let’s see if the install worked. Run:

nvm --version

If it shows a version number, you did it! 🎉

🌱 Step 6: Install Node.js

Time for the fun part — getting Node.js versions!

Here’s how to install the latest version:

nvm install node

Want a specific version? No problem:

nvm install 18.17.1

Switch between versions using:

nvm use 18.17.1

Check what versions you have installed:

nvm ls

🧠 Tip: Set a default version

You can set a default Node.js version like this:

nvm alias default 18.17.1

Now every new terminal will use that by default!

Read also :   Fun & Easy LyncConf Game Mods You Can Try Today!

🎉 Wrapping Up

That’s it! Installing NVM on Ubuntu 24.04 or 22.04 is a breeze. You now have superhero powers to manage and switch Node.js versions like a pro. 🚀

Whether you’re coding a personal site or building the next big app, NVM makes it all easier.

Coding Woman

Now go ahead, install Node.js, play with versions, and enjoy your new NVM powers!