How to Uninstall or Install nodejs on Ubuntu 22.04

Updated: October 8, 2022

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. I will show you how to install nodejs on Ubuntu 22.04 in this tutorial.

Software Requirement

  • Operating system: Ubuntu 22.04 is needed for nodejs to work
  • Privileges: Check that you can run sudo commands.

Prerequisites to install nodejs on Ubuntu 22.04

Install nodejs Ubuntu 22.04

nodejs is one of the popular ways on Ubuntu now so that this tutorial will show you some ways to install it. Choose the one you believe is simple and easy to follow.

Install nodejs using APT

This is a popular method for installing any Ubuntu packages because it is simple to understand, even if you are a Linux beginner. Following these instructions to install nodejs on your Ubuntu.

Step 1: Update the APT database to download new packages from Ubuntu. Launch the terminal and enter the following Linux command:

sudo apt-get -y update

Step 2: Install the package on Ubuntu 22.04. You can now install nodejs Ubuntu by executing this command in the terminal.

sudo apt install nodejs

Install nodejs using Aptitude

Users can manage their installation, upgrade, and removal of packages with Aptitude and view a list of the packages that are currently available. You must run this command to install it if you haven’t already done so on Ubuntu.

sudo apt -y install aptitude

Then, you can now install nodejs, just following these steps:

Step 1: Update the APT database to download new packages from Ubuntu. Opening the terminal and executing the following Linux command:

sudo apt-get -y update

Step 2: Install the package on Ubuntu 22.04. You can now install nodejs Ubuntu by executing this command in the terminal.

sudo aptitude -y install nodejs

Uninstall nodejs on Ubuntu 22.04

Have you ever thought that uninstalling an application from Ubuntu is difficult? You are mistaken; Anyone can easily uninstall any program, not just nodejs.

This command can be used to uninstall nodejs from Ubuntu 22.04 if it was installed using APT or Aptitude.

sudo apt remove --auto-remove nodejs

If you want to uninstall nodejs and remove its data and dependencies, you can also run the following command:

sudo apt autoremove --purge nodejs

Ending

In this tutorial, I showed you ways to install nodejs on Ubuntu 22.04 and ways to uninstall nodejs too. Please do not hesitate to contact me if you require any assistance. I’m delighted to respond to them.