How to install Node.js v14.x on Ubuntu 18.04 LTS

Ubuntu LTS releases are built for the long haul and even with Ubuntu 20.04 LTS
right around the corner, it may be a while before you upgrade your system. No
reason you should be stuck with an older version of Node.js the whole time.
Follow these quick and easy steps to get Node.js v14.x up and running on your
Ubuntu 18.04 LTS 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

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

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

su -c 'curl -sL | 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.