How To Install NVM (Node Version Manager) on Ubuntu System?

Harish Kumar · · 24576 Views

This tutorial will assist you with installing NVM on the Ubuntu machine. Additionally, allow you to install different node versions and other useful examples.

NVM is a Node Version Manager tool. Using the NVM tool, you can install multiple node.js versions on a single system. You can likewise pick a particular Node version for applications. It also gives a choice to auto-select node version using the .nvmrc configuration file.

Installing NVM on Ubuntu

We will use curl to install NVM. So, make sure curl is installed on your system:

sudo apt install curl

Run the following command to install NVM, and make sure to replace v0.37.2 with the latest version of NVM.

curl -o- | bash

 The script clones the nvm repository to ~/.nvm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile~/.zshrc~/.profile, or ~/.bashrc).

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/" ] && \. "$NVM_DIR/" # This loads nvm

Check the installed version, by running:

nvm --version

NVM commands

See  list all available node.js versions:

nvm ls-remote

Install latest LTS version of node:

nvm install --lts

Install a specific version of node:

nvm install 6.14.4 # or 10.10.0, 8.9.1, etc

See the list of installed node versions:

nvm ls

Switch to other installed node versions:

nvm use <your latest _working_ version from the ls>

Please login or create new account to add your comment.

You may also like:

Mastering the `` Method in JavaScript

The method in JavaScript is a powerful and versatile function used to create a new array by applying a specified function to each element of the original array. It’s (...)
Harish Kumar

JavaScript Async/Await: Writing Clean and Efficient Asynchronous Code

JavaScript is a single-threaded programming language. Thus, it means that it can execute one command at a time. How can this be possible? Well, the answer lies in the fact that (...)
Harish Kumar

React Components Explained: Function vs Class Components

React, a popular JavaScript library for building user interfaces, revolves around components. Components are the building blocks of a React application, encapsulating logic and (...)
Harish Kumar

Understanding JavaScript Promises: Advanced Techniques and Best Practices

JavaScript Promises are a powerful tool for managing asynchronous operations in JavaScript, offering a more readable and maintainable approach than traditional callback methods. (...)
Harish Kumar

JSX in React: A Comprehensive Guide

JavaScript XML (JSX) is a syntax extension for JavaScript, commonly used with React to describe what the user interface should look like. Introduced by Facebook, JSX makes it easier (...)
Harish Kumar

How to Create a React.js App Using Vite: A Step-by-Step Guide

Creating a React.js application traditionally involves using Create React App (CRA), but recently, Vite has emerged as a powerful alternative. Vite offers faster builds, hot module (...)
Harish Kumar