How To Install Node.js with Apt from the Default Repositories on Ubuntu 20.04 1

Option 1 — Installing Node.js with Apt from the Default Repositories

To get this version, you can use the apt package manager. Refresh your local package index first by typing:

$ sudo apt update

Then install Node.js:

$ sudo apt install nodejs

Check that the install was successful by querying node for its version number:


If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. In most cases, you’ll also want to also install npm, the Node.js package manager. You can do this by installing the npm package with apt:

$ sudo apt install npm

This will allow you to install modules and packages to use with Node.js.