Posted on: September 20, 2021 | Back to the homepage

How to Install Node.js on Ubuntu 20.04

Learn how to install Node.js and NPM on Ubuntu 20.04 LTS with this quick tutorial.

Cliok here to watch my video tutorial instead

Tutorial

Find the latest version of Node.js through the apt repository.

sudo apt-cache show nodejs

The apt repository version is often outdated compared to the latest long-term support version available on the Node.js website. So we will install it from there instead.

Go to the Node.js website.

https://nodejs.org/en/

Click on the ‘other downloads’ link and navigate to ‘install node.js via package manager’.

Go to the node Github.

https://github.com/nodesource/distributions/blob/master/README.md

Scroll down until you find the LTS version of Node.js and proceed to the next step.

To install Node.js you will need to make sure you have cURL installed.

curl --version

If you need to install cURL

sudo apt install curl

Now go back to the Github page we opened and follow the instructions.

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

Once this has run, you will want to check the version to confirm that node has installed as it should.

node --version

You can also check the NPM version as it was installed with Node in this case.

npm --version