3 Ways To Install Node.js on Ubuntu 22.04 LTS

3 Ways To Install Node.js on Ubuntu 22.04 LTS

How To Install Node.js on Ubuntu 22.04 LTS

Node.js is a JavaScript runtime and it is built on Chrome’s V8 JavaScript engine. In this Ubuntu 22.04 LTS tutorial post, we will show you the easy way to install Node.js on Ubuntu 22.04 LTS. There are multiple ways to install Node.js on Ubuntu 22.04 LTS. Node.js version 12.22.9, is included with Ubuntu 22.04 LTS.

 

How To Install Node.js on Ubuntu 22.04 LTS

Method 1:

1. Install Node on Ubuntu Using the Node Version Manager

In this method, we are going to install Node.js on Ubuntu 22.04 using Node version manager. Run the following commands to install node version manager at first in Ubuntu 22.04 LTS.

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

source your .bashrc file:

source ~/.bashrc

Now, run the following command to install Node on Ubuntu using NVM or Node Version Manager.

nvm  install v16.15.0

Node.js 16.15.0 is the latest stable version available.

Method 2:

2. Install Node on Ubuntu with Apt from the Default Repositories

In your Ubuntu, update your local package index first with the following command:

sudo apt  update

Now, Install node.js using the following command:

sudo apt install nodejs

Follow the onscreen instruction and If you want to install node.js package manager then execute the following command:

sudo apt install npm

3. Install Node on Ubuntu with Apt Using a NodeSource PPA

You must be wondering why we are recommending installing Node on Ubuntu using NodeSource PPA. The reason is simple as  NodeSource PPAs have more versions of Node.js available than the official Ubuntu repositories.

Run the following command to add NodeSource PPA.
cd ~
curl -sL https://deb.nodesource.com/setup_17.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh

Now, install node.js with:

sudo apt install nodejs
READ More Relevant Stuff:  Install PHP Mcrypt Extension On Ubuntu 22.04/Debian [Updated]

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *