It is available for all Operating Systems; in this article, you will learn how to install NodeJs on your Debian system (Linux OS) so that you can build amazing applications using NodeJs. Given below are three methods to install NodeJs on Debian 11, you can follow any of these you find easier for successful installation:

Installing Node.js from Debian Repository Install NodeJs using PPA Installing NodeJs using NVM

Method 1 – Installing Nodejs from Debian Repository

At the time of writing this tutorial, the Node.js 12.22.5 version is available under default repositories. To get this version of NodeJs on your Debian system follow the steps mentioned below:

Method 2 – How to install NodeJs using NodeSource PPA

You can use a PPA (Personal Package Archive) provided by NodeSource to operate with the latest version of NodeJs. This is an alternative repository containing ‘Apt’ and contains current versions than the official Debian repositories for NodeJs. Follow the steps below for successful installation of NodeJs using PPA:

Method 3 – Installing NodeJs using NVM on Debian 11

Node Version Manager, abbreviated as NVM, can also be used to install NodeJs on Debian. Instead of functioning in the operating system, NVM operates in the home directory of your user at the level of an independent directory. In other words, without impacting the overall system, you may install numerous autonomous NodeJs versions. You may use NVM to control your environment while maintaining and handling prior releases in the latest NodeJs versions. You can replace “version number” with the version you want to install, here I am installing stable version “16.x” by below mentioned command: Follow the steps given below to install NodeJs using NVM:

Set Default Version of NodeJs using NVM

If you want to set any version as default, type the below-mentioned syntax: nvm alias default [version-number] I am going to install version 16.14.0, so replace [version-number] with 16.14.0: In general, the latest version is used by nvm, you need to tell nvm to use the version you downloaded by below mentioned command: I am going to default version v16.14.0 so replace [version-number] with v16.14.0:

Test NodeJs

We can check whether our installed NodeJs is working or not; make sample JavaScript file using nano command: The file will be opened in the editor now enter the below-shown content in the file to print “Hello World” on Terminal. Press Ctrl+O to save file and press Ctrl+X to exit file:

Now to start application run below mentioned command: Run below mentioned command to test application on another terminal:

How to uninstall NodeJs from Debian 11 Bullseye

Depending on the version you wish to target, you can remove NodeJs with apt or NVM You will need to deal with the apt program on the system level to uninstall versions installed from the Debian repository or from PPA. To uninstall any of version, run the below mentioned command: If you wanted to uninstall version of NodeJs installed from NVM, for that first check the current version of NodeJs installed by below mentioned command: Then run the below-mentioned syntax to uninstall any specific version of NodeJs installed using NVM on your system: nvm uninstall [version-number] I am uninstalling current version of NodeJs, so first I need to deactivate NVM: Now run the command:

Conclusion

NodeJs is a server-side framework to build JavaScript apps. It is used for both back-end and front-end programming. In this article, we discuss its installation on Debian 11 using three methods which are using Debian’s official Repository, through PPA Repository, and also through NVM and also discuss its testing and uninstallation from the system.