How to Install Node.js 17 & NPM on Debian 11 Bullseye

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment built on Chrome’s V8 engine to build fast and scalable network applications and back-end APIs. Node.js uses an event-driven, non-blocking IO module that makes it very lightweight and practical. It is a fantastic choice for data-intensive real-time applications across distributed devices.

NPM is a package manager for the JavaScript programming language maintained by NPM, Inc. NPM is the default package manager for the JavaScript runtime environment Node.js and is arguably the most available repository for Node.JS packages.

In the following tutorial, you will learn how to install Node.JS 17 from the node source repository on Debian 11 Bullseye with the NodeSource repository.

Install Node.JS 17 from NodeSource

Before installing Node.js, make sure that you have the curl package installed.

sudo apt install curl -y

Next, install Node.JS 17 from the Node source with the following command.

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

Now run a quick APT update to reflect the newly imported repository.

sudo apt update

Install Node.js 17 with the command as follows.

sudo apt-get install nodejs -y

Verify the installation and confirm the version build of NPM; use the following command:

npm -v

Example output:

8.3.0

Given that you may be swapping Node.js versions, also good to verify using the apt-cache policy command.

apt-cache policy nodejs

Example output:

Install Node.js 17 & NPM on Debian 11 Bullseye

As above, the latest Node version is installed out of all existing Debian repositories. Since you are using the official Node source repository, you will always have the latest stable version installed.

How to Remove Node.JS & NPM

To remove Node.JS 17, use the following command:

sudo apt remove nodejs -y

Next, remove the repository for complete removal.

sudo rm /etc/apt/sources.list.d/nodesource.list

Comments and Conclusion

In the tutorial, you have learned how to install the latest Node.JS 17 version, and NPM builds using the Node Source Repository. Overall, most developers would use the LTS versions more, but having the latest version installed for learning purposes and future upgrades can be most helpful.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!