How to install Node.js 17.x on Ubuntu LTS

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

As All Hallows Eve approaches, we are greeted with a brand new “current” release of Node.js, version 17.

For those out there are aren’t aware of how Node.js releases work, even numbered releases eventually get promoted to long-term support (LTS) status, while odd numbered releases, will not.

They are effectively development releases, but in experience, tend to be more than stable enough for day-to-day production usage.

That being said, if you are running an LTS release of Ubuntu, you are more than likely running an older version of Node.js than the current release. Depending on how old your distro is, you may not even be running the latest LTS release of Node.js.

Node.js 17.x can easily be installed on Ubuntu LTS releases dating back to 16.04 which includes 18.04 and 20.04. Sorry 14.04 users, probably time to upgrade ;) You can also use this installation method to install Node.js 17.x on the wide variety of intermediate releases of Ubuntu that are still actively supported.

Before I go into how to install Node.js 17.x, I’d like to acknowledge that nvm is a viable way to install the latest version of Node.js on your system. Personally, I’m not a fan of nvm locally as it can slow down the opening of new terminals (see my workaround here). I’m also not a fan of using it in production because I’d much rather use a method that allows for updates from apt as part of my regular package update flow.

Before we get started, I think it’s a good idea to get your system completely up to date:

sudo apt update
sudo apt upgrade

Once things are updated (and you’ve rebooted if you happened to updated the Kernel), you’ll want to make sure curl is installed:

sudo apt install -y curl

With curl installed, we can pull down and execute the script that will do the hard work of adding the apt repository, installing dependencies, updating GPG keys and all that:

curl -fsSL | sudo -E bash -

With things primed and ready to go, you’ll need to install Node.js 17.x (the following will also upgrade an existing Node.js installation):

sudo apt install -y nodejs

Once installed or upgraded, node should be the latest version of the 17.x release. It’s always good practice to double check by running:

$ node --version
Join the Conversation

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.

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.

Currently Reading

Parasie Eve

Previous Reads

Buy Me a Coffee Become a Sponsor

Related Articles