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

Harish Kumar · · 26199 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- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | 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.sh" ] && \. "$NVM_DIR/nvm.sh" # 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>
0

Please login or create new account to add your comment.

0 comments
You may also like:

What are the Key Reasons to Choose a Travel Agency in Patna?

Selecting a travel agency in Patna offers a multitude of benefits. These agencies employ knowledgeable travel consultants who provide expert guidance and valuable insights regarding (...)
suvidhatravels

Learn to Write Better Code with Step-by-Step Guidance

In the world of software development, writing efficient and optimized code is a crucial skill. Whether you are a beginner or an experienced programmer, improving your coding skills (...)
Hazel Wills

Learn how to buy or invest in real estate!

Buying a home or investing in real estate doesn’t have to be complicated. With the right knowledge, you can make smart, confident decisions that maximize your investment and (...)

How to Use useEffect in React: Tips, Examples, and Pitfalls to Avoid

useEffect is one of the most commonly used hooks in React, enabling you to manage side effects like fetching data, subscribing to events, or manipulating the DOM. However, improper (...)
Harish Kumar

15 Must-Know TypeScript Features to Level Up Your Development Skills

TypeScript has become the go-to tool for developers building scalable, maintainable JavaScript applications. Its advanced features go far beyond basic typing, giving developers (...)
Harish Kumar

JavaScript Best Practices: Tips for Writing Clean and Maintainable Code

JavaScript is one of the most versatile and widely used programming languages today, powering everything from simple scripts to complex web applications. As the language continues (...)
Harish Kumar