This guide provides step-by-step instructions for installing Node.js on Debian or Ubuntu-based systems using the official NodeSource
repository.
sudo apt update && sudo apt upgrade
curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
sudo -E bash nodesource_setup.sh
sudo apt-get install -y nodejs
node -v
v22.4.1