Installing the Distro-Stable Version for Ubuntu
At the time of writing, the version in the repositories is 8.10.0. This will not be the latest version, but it should be stable and sufficient for quick experimentation with the language.
To get this version, you can use the
apt package manager. Refresh your local package index by typing:
sudo apt update
After that, Install Node.js from the repositories as follows:
sudo apt install nodejs
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 typing:
sudo apt install npm
This will allow you to install modules and packages to use with Node.js.
To check which version of Node.js you have installed after these initial steps, type:
You should now be able to use nodejs.