Blog

Installing Node.js 10 or 11 on Ubuntu 18.10: A Three-Step Upgrade

Ubuntu 18.10 — Cosmic Cuttlefish — shipped with Node.js 8 as the default. That's already behind the curve: Node 10 was six months old and about to become the next long-term support (LTS) release, while Node 11 was already out as the current release line.

The fix is the NodeSource setup script. It adds the right apt source, refreshes the package cache, and leaves you one install command away from Node 10 or Node 11.

The commands, in order

  • Make sure curl is installed:

`sudo apt-get install curl`

  • Pull and run the NodeSource installer for the version you want:

`curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -`

(replace `setup_10.x` with `setup_11.x` for the current release line)

  • Install Node.js (this also upgrades existing installs):

`sudo apt-get install nodejs`

The script adds the apt source, runs apt-get update, and the install step pulls the version you chose.

Which version should you install?

Version Use case LTS status
10.x Production apps, packages needing stability Becomes LTS on release
11.x Experiments, testing new features, bleeding edge Never LTS

For most projects, start with 10.x. Switch to 11.x only if you need features or fixes that haven't landed in 10 yet.

What to check afterward

Run `node –version` to confirm the installed major version. If it still reports 8.x, a stale node binary from an older install is likely sitting earlier in your PATH. Remove it or reorder your PATH so the newly installed version takes precedence.

Our analysis

The NodeSource script pattern is worth recognizing. It shows up across languages and runtimes — Node, Yarn, Docker, even some database clients. The shape is consistent: pipe a remote script to bash, let it add an apt source, then install from the official packages. Once you've seen it once, every subsequent setup looks familiar.

There is a trade-off hiding here. Piping curl to bash is fast and convenient — and it is exactly the kind of command security teams flag in policy reviews. For a personal development box, the convenience usually wins. For production servers, download the script first, inspect it, then run it — or mirror the repository internally and point apt at it.

What to watch: the Node.js release cadence. LTS lines move roughly every two years; current lines move every six months. Pin production environments to an LTS and let everything else ride the current line.

TAKEAWAYS

  • Ubuntu 18.10 ships with Node.js 8, which was already behind Node 10 and 11.
  • The NodeSource setup script adds the right apt repository and runs apt-get update automatically.
  • Three terminal commands — install curl, run the NodeSource installer, install nodejs — complete the upgrade.
  • Use setup_10.x for the LTS line or setup_11.x for the current release line.
  • Always verify with `node –version` after installation.
  • For production environments, inspect or host the repository yourself rather than piping curl to bash.

Frequently asked questions

Which NodeSource setup script should I use for Node 10 or Node 11 on Ubuntu 18.10?

Use setup_10.x for Node 10 (the upcoming LTS at the time) or setup_11.x for the current release line, then run sudo apt-get install nodejs.

Do I need to uninstall the old Node.js before running the NodeSource installer?

No. Existing Node installs are upgraded in place by apt when you run sudo apt-get install nodejs.

What should I check if `node –version` still shows the wrong version after installation?

A stale node binary from an older install is the usual culprit; remove the old binary or update PATH so the newly installed version wins.

Is piping the NodeSource script to bash safe for production servers?

It is fine for personal development boxes, but for production you should download and review the script first, or mirror the repository internally and point apt at it.

Why pin production environments to an LTS line of Node.js?

LTS lines move roughly every two years and receive extended support, making them a more stable target for production than the current release line.

Related