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

Josh Sherman
2 min read
Servers Node.js Debian / Ubuntu

Just because you haven’t made the jump to Debian 10 yet, doesn’t mean you shouldn’t enjoy the power of the latest and greatest version of Node.js. Follow these quick and easy steps and you’ll be running Node.js v14 on Debian 9 in no time!<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 | 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
Join the Conversation

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.

Related Articles