How to install Node.js v14.x on Ubuntu 19.10

Even though Ubuntu 20.04 LTS is right around the corner, that doesn’t mean
you’re going to jump right on it. If you’re waiting for that first point release
but still want to harness the power of the latest and greatest version of
Node.js, you can follow these quick and easy steps to get Node.js v14.x
installed on your Ubuntu 19.10 system.<h2 id=”getting-started”>Getting started</h2>

Before we can install Node.js we need to ensure that we have curl installed so
that we can easily download the script we need to run.

If you’re running inside of a Docker container, you should start by updating
your system, else you’ll run into errors about how the curl package cannot be
found:

su -c 'apt update'

Once things are up to date, install curl:

su -c 'apt install -y curl'

Adding the Node.js repository

To get things setup quickly and easily, NodeSource provides a killer
installation script. It takes care of adding the new repository, setting up the
signing keys and even takes care of any NodeSource repositories previously
installed.

Using the curl command we installed previously, we can download the script and
execute it all in one command:

su -c 'curl -sL https://deb.nodesource.com/setup_14.x | bash -'

This will take a few moments to do it’s thing, so please be patient.

Updating your packages

The aforementioned script should have resynchronized your package index files,
but it never fails that somebody comments that this guide does work, and it’s
usually because something went wrong with the update.

Please be mindful of any errors that may have occurred while running the
installation script. Once things are taken care of, or just for good measure,
you can run the update again:

su -c 'apt update'

Installing or upgrading to Node.js v14.x

With your system up to date, you can install Node.js v14.x. If you have a
previous version of Node.js installed already, either from the default
repositories or a different NodeSource repository, this command will handle
upgrading for you:

su -c 'apt install -y nodejs'

Verify the currently installed Node.js version

Once the installation is finished, you should have the latest, greatest and
eventual LTS release of Node.js installed and ready to be enjoyed.

Just to be certain that things worked as they should have, you can ask Node.js
to spit out it’s version number:

node --version # v14.0.0
Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.