DropVPS Team
Writer: John hens
how to install node js on debian 12

Table of Contents
What you will read?
Node.js is one of the most popular runtimes for building scalable web applications, APIs, and backend services. On Debian 12, installing Node.js is straightforward using the official NodeSource repository.
Step 1: Update Debian Packages
Before installing Node.js, make sure your Debian 12 system is up to date. This ensures compatibility and reduces the risk of dependency issues:
sudo apt update
sudo apt upgrade -y
Step 2: Enable the NodeSource Repository
The default Debian repositories may not include the latest Node.js version. To get the most recent LTS release, add the official NodeSource repository and then install Node.js:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
This command installs both Node.js and npm automatically.
Step 3: Verify Installation
After installation, confirm that Node.js and npm are working properly by checking their versions:
node -v
npm -v
If both commands return version numbers, your Debian 12 Node.js setup is complete.
Step 4: Install Build Tools (Optional)
Some npm packages require compiling from source. To prevent errors, install Debian’s build tools package, which provides compilers and essential libraries:
sudo apt install -y build-essential
Node.js and npm are now installed and configured on Debian 12. Build tools are also available for compiling packages from source. The system is ready to run scalable JavaScript applications, APIs, and backend services efficiently.