Apr 04, 2024

8 min read

Simple Debian Guide – Install Node.js on Debian 12

Written by

Abdelhadi Dyouri
Are you looking for a simple guide on how to install Node.js on Debian 12? This tutorial will walk you through installing both Node.js and NPM on your Debian 12 server. Node.js is a runtime for JavaScript that enables you to run JavaScript code outside of a web browser. It is mainly used for scalable backend web applications and networking tools.

How To Install Node.js on Debian 12

To install Node.js on Debian 12, you have two options. The first one uses apt to install the nodejs package from Debian’s default software repository. The second option involves using Node.js binary distributions provided by NodeSource, which allows you to install different and more recent stable versions of Node.js. Install Node.js on Debian 12 I will walk you through both options to install Node.js on your Debian server, and then you can choose whichever one you prefer.

Installing Node.js on Debian - Prerequisites

  • Basic knowledge of the Linux command line.
  • An Debian 12 server with a non-root user with sudo privileges. You can get affordable, and powerful Debian servers from our website, and you can check out our How to access your server using SSH guide to learn how to access your server and create a sudo user.

Updating the Package Cache and Installing Build Tools

Start by updating the packages in the package manager cache to the latest available versions using the following command:
sudo apt update
Before you install Node.js, it is recommended that you install build tools to compile and install native add-ons from the Node.js package manager: sudo apt install -y build-essential debian install nodejs

Option 1: Installing Node.js on Debian From the Default Repositories

For the simplest way to install Node.js on Debian, you can use apt to install the default Node.js version that is available in the default Debian repositories. However, note that this version is an LTS (long-term support) release, which is often outdated, although it has a long support period. To install the nodejs
Continue reading this article
by subscribing to our newsletter.
Subscribe now

A note about tutorials: We encourage our users to try out tutorials, but they aren't fully supported by our team—we can't always provide support when things go wrong. Be sure to check which OS and version it was tested with before you proceed.

If you want a fully managed experience, with dedicated support for any application you might want to run, contact us for more information.