Back to Notes

avatar
Nishant Singh

Software Developer

Install or update Node JS using apt on Debian based Linux distro
Wed Feb 05 2025 00:00:00 GMT+0000 (Coordinated Universal Time)

Using apt is the easiest way to install Node JS on any Debian based linux, the only issue being the packages on apt are mostly outdated. In this tutorial we will install Node JS using apt and also update it to match the latest available version.

Installation

Open terminal and execute the following commands:

sudo apt install nodejs
node -v
sudo apt install npm

Node has been installed but as discussed the Node version will most probably be outdated like version 18.0 or any version around that, while at time of writing the latest version is v22.13.1. Let’s update it to the latest version now.

Updating

Open terminal and run the following commands:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo n latest

Restart the shell and check the Node version again, now you should have the stable or the latest version depending upon the path you took.