How to Install Node.js on Debian 11
Node.js is an open-source, cross-platform JavaScript runtime environment that allows developers to build fast and scalable server-side and networking applications. In this guide, we will explain how to install the latest Node.js v24 (Current) on Debian 11 using Docker.
Update System Packages
First, update your system packages to ensure everything is up to date.
sudo apt update && sudo apt upgrade -y
Install Docker
Node.js will be installed inside a Docker container. If you do not already have Docker installed on your system, install it with the following commands:
# Install GPG
sudo apt install -y gnupg2
# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg
# Set up Docker stable repository
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian bullseye stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update apt
sudo apt update
# Install Docker
sudo apt install -y docker-ce docker-ce-cli containerd.io
Enable and start Docker
sudo systemctl enable docker
sudo systemctl start docker
Output:
root@vps:~# sudo systemctl enable docker
sudo systemctl start docker
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
Verify Docker installation
docker --version
Output:
root@vps:~# docker --version
Docker version 28.3.3, build 980b856
Pull Node.js 24 Docker Image
Download the latest Node.js (Current) image (Alpine-based for minimal size):
docker pull node:24-alpine
Output:
root@vps:~# docker pull node:24-alpine
24-alpine: Pulling from library/node
9824c27679d3: Pull complete
3126b83620d1: Pull complete
3896391fbd35: Pull complete
0e254d606f0d: Pull complete
Digest: sha256:51dbfc749ec3018c7d4bf8b9ee65299ff9a908e38918ce163b0acfcd5dd931d9
Status: Downloaded newer image for node:24-alpine
docker.io/library/node:24-alpine
Start Node.js Container
Run a Node.js container with interactive shell access:
docker run -it --rm --entrypoint sh node:24-alpine
This will open a shell inside the container.
Verify Node.js and npm Versions
Inside the container, check the installed versions:
node -v
Output:
v24.6.0
npm -v
Output:
11.5.1
Run a Test Node.js Script
To confirm Node.js is working, create a simple test file.
echo "console.log('Hello from Node.js on Debian 11 via Docker!');" > test.js
node test.js
Output:
Hello from Node.js on Debian 11 via Docker!
Conclusion
You have successfully installed Node.js v24 (Current) with npm on Debian 11 using Docker.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS