How to Install Node.js on Ubuntu 21.04 and 21.10

Last updated on November 14, 2021 Pennywise Loading... Post a comment

This article shows you how to install Node.js and NPM on Ubuntu 21.04 (Hirsute Hippo) or Ubuntu 21.10 (Impish Indri). Our goal is to get the LTS (the long-term support version, which is officially recommended for most users) or the current version (which comes with the latest features) of Node.js.

If you set up Node.js with the following command:

sudo apt install nodejs

You will end up with Node.js 12, a very old version. That is NOT what we want. At the time of writing, the LTS version is 16 and the current version is 17.

Installing Node.js the right way

To install a desired version of Node.js, we first have to install a PPA (personal package archive) from NodeSource.

1. Navigate to the home directory:

cd ~

2. Run the following:

curl -fsSL | sudo -E bash -

You can substitute 17.x with another version as needed. After a while, you will see this:

We are not done yet.

3. Get Node.js and NPM installed by executing this command:

sudo apt-get install -y nodejs


4. Check the versions of Node.js and NPM that were installed on your machine with the commands below:

node -v


npm -v

You should get some output similar to this:

Congratulations! Your work has succeeded.


You’ve learned how to install Node.js and NPM on Ubuntu 21.04 and 21.10. If you’d like to explore more modern stuff of Node, take a look at the following articles:

You can also check out our Node.js category page or PHP category page for the latest tutorials and examples.

Notify of
Inline Feedbacks
View all comments

Related Articles