Home Linux ServerWeb Server How to install Node.js with NVM on Ubuntu 22.04

How to install Node.js with NVM on Ubuntu 22.04

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

Installing Node.js with NVM on Ubuntu 22.04 with 2 steps.

Introduction

Node.js is a software system designed for writing scalable internet applications, especially web servers. The program is written in JavaScript, using event-driven, asynchronous input/output to minimize overhead and maximize scalability. Node.js includes Google’s V8 JavaScript engine, libUV and several other libraries. Node.js was created by Ryan Dahl in 2009 and developed under the umbrella of Joyent.

NVM is an acronym for Node.js Version Manager, a flexible tool for installing and managing multiple versions of Node.js and related packages simultaneously.

In this tutorial, we will learn how to install a specific version of Node.js through NVM, please see the installation section below.

Implementation Guide

Step 1: Install NVM

To install or update NVM, you can use the curl command to download and execute the file. You can download the latest version from the nvm official repository

  • Download the installation file
AZDIGI Tutorial
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    
  • Run the install command
AZDIGI Tutorial
source ~/.bashrc
    
  • To check if NVM has been installed successfully, please run the following command:
AZDIGI Tutorial
command -v nvm
    
  • To check if NVM has been installed successfully, please run the following command:
How to install Node.js with NVM on Ubuntu 22.04

Step 2: Install Node.js

  • Once you’ve installed NVM, you can list all the Node.js versions available through NVM using ls-remote with the following command:
AZDIGI Tutorial
nvm ls-remote
    
  • After running the above command, the system will display a list of Node.js versions. You can install any of the versions shown here.
How to install Node.js with NVM on Ubuntu 22.04

For example, if you want to install Node.js version 16.15.0, you can simply use the install command as follows:

AZDIGI Tutorial
nvm install v16.15.0
    
How to install Node.js with NVM on Ubuntu 22.04
  • Check the results after installation
AZDIGI Tutorial
node -v
    
How to install Node.js with NVM on Ubuntu 22.04

Above are the steps to install Node.js through NVM in the most detail. With NVM, you can easily manage and install different versions of Node.js straightforwardly. Wishing you success!

You can refer to other instructions at the link below:

If you need support, you can contact support in the ways below:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign