Installing Node.js on Ubuntu

According to the Node.js documentation (https://nodejs.org/en/download/package-manager/), the recommended installation method for Debian or Ubuntu Linux distributions is the following:

$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -$ sudo apt-get update
$ sudo apt-get install -y nodejs build-essential  

We've seen this before, so substitute the Node.js desired version number in the URL. Installing this way means that as new Node.js releases are issued, upgrades are easily accomplished with the normal package management procedures. 

Get Node.js Web Development - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.