How-To: Install Node.js On Ubuntu 22.04

0
210

Installation of Node.js on an Ubuntu 22.04 operating system. At the time of this writing, the stable version is 18.16.0 (LTS) and the current version is 20.1.0.

Download and install via the package manager

Current version : 20.x.

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs

Stable and LTS version: 18.x

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && sudo apt-get install -y nodejs

Install via snap

Current version : 20.x.

sudo snap install node --classic --channel=20

Stable and LTS version: 18.x

sudo snap install node --classic --channel=18

Test Node.js

01. To test if the installation and scripts are working

curl -sL https://deb.nodesource.com/test | bash -

02. Another way is to check the version, but this is only available if used via the package manager.

node --version

Uninstall 

Via the package manager

sudo apt-get purge nodejs && sudo rm -r /etc/apt/sources.list.d/nodesource.list

Via snap

sudo snap remove node

After uninstall you can verify that they are removed using the previous steps we used for testing.

Source: Cyberpogo



For enquiries, product placements, sponsorships, and collaborations, connect with us at hello@firegulaman.com. We'd love to hear from you!