Install the latest version of npm and Nodejs on Ubuntu.

By
Darío Rivera
Posted On
in
Ubuntu
It is common to find that the stable version of Ubuntu does not have updated npm and nodejs packages. Whether you only need to update npm or nodejs, in this post we will show you how to do it.
Installation
The first thing you should do is add the PPA to your system from the official Nodejs repository. In addition, you also need to install the software-properties-common package if it is not already installed on your system. In this case we are going to assume that you will install the latest LTS version.
sudo apt-get install curl software-properties-common
curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
After this, you can run the command to install nodejs.
sudo apt-get install -y nodejs
Do not forget to verify the version of each component with the following commands.
$ node -v
v12.18.4
$ npm -v
6.14.6
Until next time.