Blog

Install Node.js 12 on Debian and Ubuntu the Clean Way

The Node.js team released v12.0.0 last week. It is the next long-term support line, codenamed Erbium, scheduled to become the active LTS in October 2019 with maintenance running until April 2022. If you are starting anything new today, 12.x is the right target. If you are still running the 6.x (Boron) line, that branch hits end of life at the end of this month—time to move.

At a glance

  • Node.js 12.0.0 (Erbium) launched and is on track to become LTS in October 2019.
  • LTS maintenance for the 12.x line is scheduled to end in April 2022.
  • The guide targets Debian 8 and newer plus Ubuntu 16.04 LTS and newer.
  • The official NodeSource setup script handles the apt repo, signing keys and any prior NodeSource installs.
  • Verification is one command: `node -v`.

Who should care

Scenario Action
Starting a new project today Use 12.x immediately
Already on 10.x (Dubnium) Stay put until October; 10.x stays supported until April 2021
Still on 6.x (Boron) Upgrade now—end of life hits this month
Running 8.x or 9.x Plan an upgrade; both are past their support windows

The NodeSource script replaces any existing NodeSource installation in place. You do not need to manually uninstall first.

Why speed and LTS timing matter

Speed improvements headline v12. For side projects, hobby servers, or CI boxes, this means less waiting on builds and test runs. The LTS window is the practical payoff: a runtime that receives security patches for years without intervention. You deploy once, patch occasionally, and avoid the upgrade scramble that hits when a major version goes stale.

The clean install path

The guide uses `su` rather than `sudo` because Debian does not ship with sudo by default. From a root session:

“`bash

# Grab curl and update package lists

Su -c 'apt update && apt install -y curl'

# Add the NodeSource repository for 12.x

Su -c 'curl -sL https://deb.nodesource.com/setup_12.x | bash -'

# Install or upgrade to Node.js 12.x

Su -c 'apt install -y nodejs'

“`

The NodeSource script adds the apt source, imports the signing key, and silently removes any old NodeSource repo entries so your package index stays clean. Total commands: three.

Verifying and troubleshooting without panic

Run `node -v`. You should see a version starting with `v12.`. If you see an older number, the install did not replace your existing runtime. That usually means the `apt update` inside the NodeSource script errored out—often because another third-party repo is misconfigured. Read the output line by line. Skipping error messages is how people end up wondering why their "upgrade" is still running an old version. The terminal is telling you something; listen.

Bottom line

Use Node 12 for any new project. Use the NodeSource script, not the default Debian or Ubuntu repos, because those ship outdated versions. And actually read what the terminal tells you.

Key takeaways

  • Pick Node 12 (Erbium) for greenfield projects so you ride the LTS until 2022.
  • Run the NodeSource setup script with `su`, not `sudo`, on a clean Debian box.
  • Always read the apt output; a silent failure there is why your "upgrade" did not upgrade.

Frequently asked questions

Can I install Node 12 on Ubuntu 19.10 or later?

The script supports Debian and Ubuntu-based distros, including future releases. As long as the base is Debian or Ubuntu, the same commands work.

Do I need to uninstall Node 10 first?

No. The NodeSource script replaces the binary in place. `apt install -y nodejs` will upgrade a 10.x install to 12.x without a separate remove step.

What about macOS or Windows?

This guide covers Debian and Ubuntu only. For other platforms, use the official installer from nodejs.org or a version manager like nvm.

Is Node 12 stable enough for production?

It just became the current release line and is on track to become LTS. Most teams wait until the LTS promotion in October, but running current on a side project is fine.

Which Debian and Ubuntu versions does this support?

Debian 8 (Jessie) through Debian Sid, and Ubuntu 16.04 LTS through 19.04 and beyond. The script adapts to the base OS automatically.

Related