Node.js lets Ubuntu systems run JavaScript services, command-line tools, and build scripts without a browser. Installing the distro package keeps the runtime under normal APT maintenance for hosts that use operating-system packages as their update source.
Ubuntu publishes the runtime as the nodejs package, while the package manager command is installed separately as npm. The installed runtime command is node, so verification should check node –version rather than the package name.
The repository version follows the Ubuntu release rather than the latest upstream Node.js release. Use the distro package when the project accepts that release line, and use a version-specific source when a project requires a newer upstream LTS or Current line.
$ sudo apt update
$ sudo apt install --assume-yes nodejs npm Reading package lists... Building dependency tree... Reading state information... Solving dependencies... Installing: nodejs npm ##### snipped ##### Setting up nodejs (22.22.1+dfsg+~cs22.19.15-1ubuntu1) ... ##### snipped ##### Setting up npm (9.2.0~ds3-1) ...
The exact package versions depend on the Ubuntu release and update pocket. On Ubuntu 26.04, expect a Node.js 22 package and a separate npm 9 package.
$ node --version v22.22.1
The package is named nodejs, but the runtime command is node.
$ npm --version 9.2.0
$ node --eval "console.log('Node.js is working')"
Node.js is working