Install Node.js on Debian 11 (bullseye)

For this article, we will install NodeJS19 on a Debian 11 (bullseye) system. Here are the installation instructions:

Node.js v19.x:
Using Debian, as root

$ curl -fsSL https://deb.nodesource.com/setup_19.x | bash - &&\
apt-get install -y nodejs

Output:

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


## Populating apt-get cache...

+ apt-get update
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Ign:4 http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 InRelease
Hit:5 http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 Release
Reading package lists... Done

## Confirming "bullseye" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_19.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

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

+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_19.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_19.x bullseye main' >> /etc/apt/sources.list.d/nodesource.list

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

+ apt-get update
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://security.debian.org/debian-security bullseye-security InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Ign:4 http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 InRelease
Hit:5 http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 Release
Get:7 https://deb.nodesource.com/node_19.x bullseye InRelease [4,586 B]
Get:8 https://deb.nodesource.com/node_19.x bullseye/main amd64 Packages [771 B]
Fetched 5,357 B in 1s (5,528 B/s)
Reading package lists... Done

## Run `sudo apt-get install -y nodejs` to install Node.js 19.x and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
     echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn


Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 29.0 MB of archives.
After this operation, 183 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_19.x bullseye/main amd64 nodejs amd64 19.0.0-deb-1nodesource1 [29.0 MB]
Fetched 29.0 MB in 2s (17.8 MB/s)
Selecting previously unselected package nodejs.
(Reading database ... 35562 files and directories currently installed.)
Preparing to unpack .../nodejs_19.0.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (19.0.0-deb-1nodesource1) ...
Setting up nodejs (19.0.0-deb-1nodesource1) ...
Processing triggers for man-db (2.9.4-2) ...

Leave a Comment

Your email address will not be published. Required fields are marked *

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