nvm command not found - Ubuntu

Page content

How to Install Node Version Manager (nvm) on Ubuntu

Introduction

Node Version Manager, commonly known as nvm, is a tool that allows you to easily manage multiple Node.js versions on your system. With nvm, you can install, switch between, and remove different versions of Node.js with just a few simple commands. This flexibility is particularly useful for developers working on projects that require specific Node.js versions or for testing compatibility across different versions.

In this tutorial, we will guide you through the process of installing nvm on Ubuntu and demonstrate how to use it effectively.

Step 1: Install nvm on Ubuntu

To begin, open your terminal and run the following command to download the nvm installation script:

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

This command will download and execute the nvm installation script, setting up nvm on your Ubuntu system.

After the installation completes, you will need to source the nvm script to make the command available in your current shell session. You can do this by running:

source ~/.bashrc

Step 2: Verify the Installation

To verify that nvm has been installed successfully, you can run the following command to check the nvm version:

nvm --version

If the installation was successful, you should see the version number of nvm displayed in the terminal.

Step 3: Using nvm

Now that nvm is installed, you can start using it to manage your Node.js versions. To install a specific version of Node.js, you can use the following command format:

nvm install <node_version>

For example, to install Node.js version 14, you would run:

nvm install 14

After installing a Node.js version, you can switch to it using:

nvm use <node_version>

To list all installed Node.js versions, you can use:

nvm ls

Conclusion

In this tutorial, we have covered the installation of Node Version Manager (nvm) on Ubuntu and demonstrated how to manage Node.js versions using nvm. By using nvm, you can easily switch between different Node.js versions based on your project requirements, enhancing your development workflow and productivity.


The Importance of Open Source Software

Open source software plays a crucial role in the technology industry by fostering collaboration, innovation, and transparency. It enables developers to access and contribute to a wide range of projects, driving progress and empowering individuals and communities worldwide. By supporting open source initiatives like nvm, we contribute to a more inclusive and sustainable digital ecosystem for everyone.