Installing Node.js via Package Manager on Debian 12

Node.js has provided ease in Java developers’ lives because, with the help of this tool, developers can run and test their Java script without the limitation of the web browser. It is used not only for the development of APIs and web applications but also can be used to create desktop applications. 

It is based on JavaScript as the primary programming language and also based on Google’s V8 JavaScript engine. The applications based on can be run as a single-threaded loop. 

In this post, the installation method for Node.js has been explored via the package manager on Debian 12. 

What is the Method for Installing Node.js via Package Manager on Debian 12?

There are different approaches through which the Node.js can be installed on Debian 12 and all these methods are explained in the mentioned blog

The default package managers of every Linux distribution can be used for the installation of Node.js. The packages available in the default repositories of Linux distributions are maintained by the particular distribution’s development teams. 

To install Node.js via package manager on Debian 12, follow the below-mentioned steps.

Step 1: Launch the Terminal

First launch the terminal of Debian to run the commands:

Step 2: Update the Packages

Now use the “update” option of the apt package manager to update all the packages:

$ sudo apt update

Step 3: Show the Node.js Package

The default repository of Debian 12 contains the “Node.js” package that can be found by using the apt package manager:

$ sudo apt show nodejs

Step 4: Install the Node.js on Debian 12

Now using the default package manager of Debian, install the Node.js package from its repository:

$ sudo apt install nodejs

Type the “y” to proceed with the installation as shown:

Step 5: Verify the Installation

To verify the installation of the Node.js, display its installed version with the execution of the command:

$ nodejs --version

Node.js has successfully been installed on Debian 12 via its package manager. 

How to Uninstall Node.js on Debian 12?

To uninstall the Node.js with all its configuration files, execute the following command:

$ sudo apt purge nodejs -y

Also, to remove the libraries associated with the Node.js package with the command:

$ sudo apt autoremove -y

This is all about the installation of the Node.js via package manager on Debian 12.

Conclusion

To install Node.js via package manager on Debian, run the “sudo apt install nodejs” command. The default package manager of Debian 12 will install the package from its default repository. This post has explained all the steps involved in the installation of the “Node.js” via Debian’s package manager.