This page explains how to install node.js on Ubunutu. The following has been performed with the following versions:
Start by updating your system with the following commands:
sudo apt update -y sudo apt upgrade -y
The simplest way to install node.js is to use apt-get:
sudo apt install nodejs
I strongly recommand to install npm (Node.js Packet Manager) with node.js. The following command installs npm:
sudo apt install npm
You can check that node.js is successfully installed by checking the version curently installed:
In my case, this is the version 8.10.0. If you want the lastest version, run the
following commands to clean npm's cache and install
n for managing versions:
sudo npm cache clean -f sudo npm install -g n
You can now upgrade node.js to the latest version:
sudo n stable PATH="$PATH"
Now, check which version is currently installed with
node -v. In my case, the latest
stable version is the 12.16.0.
If you need a specific version, you can install like this:
sudo n 13.8.0 PATH="$PATH"