How to Install and Upgrade Node.js v12.x, v13.x on Ubuntu 18.04 LTS

This article will guide you to install Node.js latest version on Ubuntu 19.04, 18.04, 16.04 LTS and Debian:

Supported Ubuntu versions:

  • Ubuntu 14.04 LTS (Trusty Tahr) - not available for Node.js 10 and later
  • Ubuntu 16.04 LTS (Xenial Xerus)
  • Ubuntu 18.04 LTS (Bionic Beaver)
  • Ubuntu 18.10 (Cosmic Cuttlefish)
  • Ubuntu 19.04 (Disco Dingo)

Supported Debian versions:

  • Debian 8 / oldstable (Jessie)
  • Debian 9 / stable (Stretch)
  • Debian 10 / testing (Buster)
  • Debian unstable (Sid)

First, you’ll want to make sure that you have curl installed. Doesn’t hurt to run an update while you’re in there as well:

sudo apt-get update
sudo apt-get install curl

Node.js v13.x:

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_13.x | bash -
apt-get install -y nodejs

Node.js v12.x LTS (Recommended For Most Users):

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install -y nodejs

Node.js v11.x:

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_11.x | bash -
apt-get install -y nodejs

Node.js v10.x:

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y nodejs

Node.js v8.x:

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_8.x | bash -
apt-get install -y nodejs

Optional: install build tools

use sudo on Ubuntu or run this as root on debian

apt-get install -y build-essential

If you already have Node.js installed, don’t worry, that command will just upgrade the current version to the latest version.

To confirm that everything worked as expected, just spit out the version from the node command to confirm:

node --version

That’s all there is to it! Now you’re running the latest version of Ubuntu or Debian and the latest version of Node.js.

#node #node-js #nodejs #ubuntu

How to Install and Upgrade Node.js v12.x, v13.x on Ubuntu 18.04 LTS
1 Likes107.05 GEEK