How to install Node js & NPM on Debian 11 Bullseye

Node.js is a platform that allows developers to developed tools using Javascript and also prepares scripts to run on the server-side. The best thing. it is an open-source Javascript framework that can be used on all popular operating systems. Nodejs uses the Google V8 engine and executes Javascript code outside a web browser.

Here, we will know the steps to install Node.Js latest and current version on Debian 11 Linux using a command terminal that also works for Ubuntu 20.04/18.04, Linux Mint, and other similar Linux distros.

Node js Installation on Debian 11 Bullseye Linux

1. Install Curl

By default, there will not be a Curl tool on Debian 11, but we need it to add to the repository. Therefore, use the below command to install it:

sudo apt install curl

2. Add Node Js Repository

Although we already have the node.js to install on Debian 11 using its default base repo, however, the version will be old. Hence those who want to get the latest and current version of Node need to add the official Node.js repository manually on Debian Bullseye.

Note: Add only one.

For Latest Version

curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -

For LTS- Lont Tem Support versions use this repo instead above one:

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -

OutPut:

## Installing the NodeSource Node.js 16.x repo...

## Populating apt-get cache...

+ apt-get update
Hit:1 http://deb.debian.org/debian bullseye InRelease 
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Fetched 111 kB in 11s (9,703 B/s) 
Reading package lists... Done

## Confirming "bullseye" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_16.x/dists/bullseye/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null
gpg: WARNING: unsafe ownership on homedir '/home/h2s/.gnupg'

## Creating apt sources list file for the NodeSource Node.js 16.x repo...

+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x bullseye main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x bullseye main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

3. Check available Node.js versions to install

Before installing let’s check whether the latest current of Node is on our system or not.

sudo apt policy nodejs
Check NodeJS version

4. Install Nodejs and NPM on Debian 11

Finally, use the APT package manager to download and install the latest available version using the command terminal.

sudo apt install nodejs

5. Check version

Well, finally we have both Node.js and NPM- Node package manager. Lets’ check their versions.

node -v
npm -v

Once the installation is completed, you can learn more about it and its usage from the official documentation.

Other Articles:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.