To install the latest version of Node.js on Ubuntu or Debian, use the NodeSource PPA. The default repositories in Ubuntu and Debian often do not include the latest version of Node.js. Using the NodeSource PPA ensures you have access to the most recent stable release.

The installation process using the NodeSource PPA is direct and reliable. This method ensures compatibility with the latest features and security updates. You can easily configure your system to install and maintain the latest version of Node.js.

For users requiring the latest Node.js on Ubuntu or Debian, the NodeSource PPA is the recommended method. It bypasses the limitations of the default package manager, ensuring your environment stays up-to-date and secure.

If you require Ubuntu's officially supported version of Node.js, you can install the one provided in its default apt repository.
Related: How to install Node.js on Ubuntu or Debian

Steps to install latest Node.js on Ubuntu or Debian:

  1. Open the terminal application.
  2. Install curl if not already installed.
    $ sudo apt update && sudo apt install --assume-yes curl
  3. Add PPA for specific Node.js version via NodeSource's official PPA setup script.
    $ curl --silent --location https://deb.nodesource.com/setup_10.x  | sudo bash -

    Replace 10.x with 12.x, 11.x or 9.x, depending on your actual required version

  4. Install Node.js using apt.
    $ sudo apt install --assume-yes nodejs 

    npm is automatically installed as dependency and does not require separate installation.

  5. Verify the installation by checking the versions of nodejs and npm.
    $ nodejs -v
    v10.9.0
    $ npm -v
    6.2.0

This guide is tested on Ubuntu:

Version Code Name
22.04 LTS Jammy Jellyfish
23.10 Mantic Minotaur
24.04 LTS Noble Numbat
Discuss the article:

Comment anonymously. Login not required.