The latest and greatest long term service release of Ubuntu is here and there’s
no reason that you shouldn’t get to enjoy the latest and greatest (soon to be)
long term service release of Node.js as well. Follow these quick and easy steps
to install Node.js v14.x on your shiney new Ubuntu 20.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
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
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