How to install node js on Debian Bullseye

NodeJS is often mistaken as a framework of JavaScript, but in reality, it is not a framework of JavaScript but JavaScript in runtime. NodeJs is most commonly used to develop the back-end or the server side of full-stack applications. If you are trying to become a full-stack developer or only a server-side \ backend developer then NodeJS can be your priority.

NodeJS is probably the most famous JavaScript environment. That is because it provides various incredible libraries of JavaScript modules which help greatly in the development of full-stack web applications. It even eases the process of developing a web-based application. With the ever-increasing demand for web applications due to COVID-19, the popularity of NodeJs grew even more drastically.

With the release of the newest Debian distro of Linux the Debian 11, many people have shifted to Debian 11. It is common for people to shift to a new distro and not know how to install various programs and environments on it, for example, the NodeJs environment. So, the purpose of this tutorial would be to show how to install NodeJs on Debian 11 (Bullseye).

Installing NodeJS from Debian repository

There may be other ways of installing NodeJs on different Linux distributions even for Debian 11, but the most efficient and the most recommended method of installing NodeJS and NPM would be to use the official Debian repository, as it keeps us safe from various malware\viruses and other bloatware.

So, to install NodeJs and NPM, the steps are:

  • Update Packages Repository
  • Install NodeJs
  • Install NPM
  • Confirm Installation

Step 1: Update Packages Repository

To start with the first step, you need to open up a new terminal in Debian 11 and run the following command in it.

$ sudo apt update

You’ll be prompted for credentials as this command requires the user to be a SuperUser or to have Sudo rights (administrative rights for Linux). After hitting enter, let the process of updating complete, and once it’s done you would see this:

This means that you have successfully updated all the packages and now you can move on to the next step.

Step 2: Install Nodejs and NPM:

After the prereq of this process is done, which is to update the packages, we can move ahead and try installing nodeJs and npm together with the command given below:

$ sudo apt install nodejs npm

Type this command in the terminal. This command will install NodeJS and “npm” which is the package manager of NodeJS:

After pressing the enter button it’ll prompt you that it will take some space, type in “Y” to continue as shown below:

After this, it’ll start downloading NodeJS and NPM. After it has finished downloading you should have node and npm installed on your Debian 11 computer.

Step 3: Check version:

We need to make sure that we have successfully installed NodeJs on Debian 11 or not, and to do that the command is:

$ node -v

Type this command in the terminal and hit enter. You should see the node version like this:

This proves that we have successfully installed the NodeJs in our Debian 11 Linux distribution. Now we can focus on developing that full-stack web application that we always wanted to on Debian 11.

Using NodeSource PPA

Now, although we have learned how to install NodeJs using the official repository, the thing is, the latest version of NodeJS is not always available on the official Debian repository, and most of the times packages require the latest version of NodeJs. We can get the latest version NodeJs as well, thanks to nodeSource PPA (PPA stands for personal package archive).

First off, you need to switch to the root user using the following command,

$ su - root

Type this command in the terminal, and the terminal will prompt you for the credentials, type in the credentials, and hit enter:

Once you have switched over to the root user, you need to install PPA, to do that, you need to have curl installed on your system, so lets first install CURL with the following command.

$ sudo apt install curl -y

And hit enter, you will see that it will start the installation of curl like so:

Once that is done, we can install the node source PPA with the following command

$ curl -fsSL | sudo -E bash -

Type the command in the terminal and press enter, and wait for the installation to finish.

Once, you have installed PPA you need to update all the packages, just like step 1 in the previous method. do that with the following command and hit enter

$ sudo apt update

Let the packages update like:

Finally, we can install the latest version of NodeJs by using the command:

$ sudo apt install nodejs -y

Type this command in the terminal and hit enter, and wait for the installation process to finish

Once the installation is done, the only thing left is to confirm the installation process by checking the version of the NodeJs, using the following command.

$ node -v

You should see:

To check the version of npm, use the command

$ npm -v

You should see:

As you can see, by using the PPA we get the latest version of NodeJs, which is sometimes not available in the official Debian repository.


Installing NodeJS on Debian 11 may seem a little tricky at first but in reality, it isn’t tricky at all. NodeJs is a runtime JavaScript environment that is essential for developing full-stack or web applications. We have learned to install the NodeJS on Debian 11 using the official Debian repository and through the node source PPM. Now you can develop top-notch full-stack applications and much more using NodeJs.