How to Install Node.js 24 on Debian 12
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 12 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:
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
Enable and start Docker
sudo systemctl enable docker
sudo systemctl start docker
Verify Docker installation
docker --version
Pull Node.js 24 Docker Image
Download the latest Node.js (Current) image (Alpine-based for minimal size):
docker pull 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 12 via Docker!');" > test.js
node test.js
Output:
Hello from Node.js on Debian 12 via Docker!
Conclusion
You have successfully installed Node.js v24 (Current) with npm on Debian 12 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