How to install Node.js v14.x on Debian 10

Already running the latest and greatest version of Debian, version 10, and want
to run the latest and greatest version of Node.js? If so, follow these quick and
easy steps and you’ll be off to the races with Node.js v14.x.<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.