Logo

How To Install NVM on Ubuntu 24.04

Mar 17, 2024

To install NVM on Ubuntu 24.04, follow the steps below.

Step 1 : Ensure your package index is up-to-date:

sudo apt update

Step 2 : Install the required packages for building NVM and Node.js:

sudo apt install build-essential libssl-dev curl

Step 3 : Download and install the NVM installation script using curl:

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

Step 4 : Source the bash profile to load NVM environment variables:

source ~/.bashrc

Step 5 : Verify that NVM is installed correctly by checking its version:

nvm --version

Step 6 : Basic NVM Usage

- Install a specific version of Node.js:

nvm install <node_version>

- Use a specific version of Node.js:

nvm use <node_version>

- Set a default Node.js version:

nvm alias default <node_version>

- Check the version of Node.js in use:

node --version

- List installed Node.js versions:

nvm ls

Congratulations! You have successfully installed NVM on Ubuntu 24.04.

Recommended