How to Install Node.js and Npm on Ubuntu 22.04

Install Node.js and Npm on Ubuntu 22.04

In this article, we will have explained the necessary steps to install Node.js and Npm on Ubuntu 22.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Node.js is a platform for developing standalone JavaScript programs that run independently of host applications such as web browsers. Node.js is based on Google’s JavaScript engine V8, which is also used in the Chrome web browser. Npm is the default package manager for Node.js and also the name of the world’s largest software registry.

Install Node.js and Npm on Ubuntu 22.04 LTS

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade
sudo apt install apt-transport-https curl wget

Step 2. Install Node.js and npm on Ubuntu Linux.

  • Method I

Install Node.js and npm from the Ubuntu repository.

Installing the Node.js on your Ubuntu 22.04 Jammy Jellyfish system is straightforward, Now execute the following command on the command prompt to install the Node.js package:

sudo apt install nodejs npm

Check the installed Node and NPM version on Ubuntu:

nodejs --version
  • Method II

Install Node.js and npm from NodeSource.

Now Run the following command to download and execute the NodeSource installation script:

curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -

After adding the PPA repository of the Node.js, we will install it using the apt package manager:

sudo apt install nodejs

Confirm the installation of the Node.js by displaying its version:

nodejs --version

That’s all you need to do to install Node.js on Ubuntu 22.04 LTS Jammy Jellyfish. I hope you find this quick tip helpful. For further reading on the installation of Node.js and Npm, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.