How to Install NVM on Ubuntu 22.04

Install NVM on Ubuntu 22.04

In this article, we will have explained the necessary steps to install NVM on Ubuntu 22.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

NVM (Node Version Manager) is a version manager for Node.js, designed to be installed per user, and invoked per shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: Unix, macOS, and windows WSL.

Install NVM on Ubuntu 22.04 Jammy Jellyfish

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install NVM on Ubuntu Linux.

Installing Node Version Manager on your Ubuntu 22.04 Linux system is straightforward, Now we Run the following command to install the NVM on the Linux system:

curl -o- | bash

The nvm installer script creates an environment entry to the login script of the current user. You can either log out and log in again to load the environment or execute the below command to do the same:

source ~/.bashrc

To verify the installed package:

npm -v

With NVM you can install Node.js and switch between different versions:

nvm install node

You can use the following command to list installed versions of the node for the current user:

nvm ls

List available node.js versions for the installation:

nvm ls-remote

That’s all you need to do to install NVM on Ubuntu 22.04 LTS Jammy Jellyfish. I hope you find this quick tip helpful. For further reading on the Install NVM (Node Version Manager), please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.