Per the Node.js website:

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

Then, you will have the latest version of Node.js.

If you're not a fan of curl <url> | bash -, or are using an unsupported distribution, you can try a manual installation.

Answer from jrg on askubuntu.com
๐ŸŒ
Node.js
nodejs.org โ€บ en โ€บ download
Node.js โ€” Download Node.jsยฎ
Download a signed Node.js source tarball. Check out our nightly binaries or all previous releases or the unofficial binaries for other platforms. We are able to serve Node.js's downloads and maintain our infrastructure proudly due to the support of these partners, and more.
Discussions

In an Ubuntu 22 I can't install node latest version
thanks for letting us know! More on reddit.com
๐ŸŒ r/Ubuntu
8
0
March 7, 2024
[Ubuntu] How to install a newer version of Node than the one provided by apt?
Nvm solves all my issues with version swapping More on reddit.com
๐ŸŒ r/node
13
12
April 17, 2022
npm - How can I install Node.js version 18 on Ubuntu 22.04? - Stack Overflow
Doesn't seem so deprecated anymore... ... for Ubuntu and Debian, up through the latest (so far). github.com/nodesource/distributions 2024-10-23T10:03:33.787Z+00:00 ... I tried those same steps, and they also didn't work for me. What you need to do is to remove the old version of nodejs first and then autoremove any lingering packages. sudo apt purge nodejs sudo apt autoremove sudo apt install ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
node.js - how to install a latest version of Nodejs on Ubuntu? - Stack Overflow
I start using ubuntu (22.04.1) recently. I want to install nodejs latest version (currently v18.12.1 LTS). But my node --version showing version v12.22.9. First I install node using sudo apt-get in... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ how-to-install-node-js-on-ubuntu-20-04
How to Install Node.js on Ubuntu | DigitalOcean
May 2, 2025 - To update Node.js on Ubuntu, you can use the package manager you used to install it. If you used apt, you can update Node.js by running sudo apt update && sudo apt full-upgrade. If you used NVM, you can update Node.js by running nvm install node --latest.
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ how-to-install-node-js-on-ubuntu-22-04
How to Install Node.js on Ubuntu (Step-by-Step Guide) | DigitalOcean
May 28, 2025 - Before proceeding, we recommend ... Ubuntu installation. These steps are valid for the most recent versions of Ubuntu: Ubuntu 24.04, Ubuntu 22.04, and Ubuntu 20.04. If you are using Ubuntu version <= 18.04, we recommend you upgrade to a more latest version since Ubuntu no longer provides support for the older versions. This collection of guides will help you in upgrading your Ubuntu version. Ubuntu contains a version of Node.js in its default ...
๐ŸŒ
Node.js
nodejs.org โ€บ en โ€บ download โ€บ package-manager โ€บ all
Node.js โ€” Installing Node.js via package manager
October 15, 2025 - Node.js and npm packages are available in the main Repository for Fedora and RHEL 10. It can be installed from a default stream which contains the currently active LTS Node.js version.
๐ŸŒ
Reddit
reddit.com โ€บ r/ubuntu โ€บ in an ubuntu 22 i can't install node latest version
r/Ubuntu on Reddit: In an Ubuntu 22 I can't install node latest version
March 7, 2024 - Warning: The version of Node.js included with Ubuntu 22.04, version 12.22.9, is an LTS, or โ€œlong-term supportโ€ release. It is technically outdated, but should be supported until the release of Ubuntu 24.04 ... install it via NVM, and not through bloated and unecessary things like snap, or whatever else Ubuntu has to offer
๐ŸŒ
npm
docs.npmjs.com โ€บ downloading-and-installing-node-js-and-npm
Downloading and installing Node.js and npm | npm Docs
We do not recommend using a Node ... to download the latest version of npm, on the command line, run the following command:npm install -g npm...
Find elsewhere
๐ŸŒ
Medium
medium.com โ€บ @redswitches โ€บ install-the-latest-node-js-version-on-ubuntu-22-04-ca7d7c83a5b0
Install the Latest Node.js Version on Ubuntu 22.04 | Medium
August 29, 2024 - Q. How can I install Node.js on Ubuntu 22.04 using nvm? First, install nvm using a script. Then, use nvm to install the latest version of Node.js by running nvm install node.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ how-to-install-node-js-on-ubuntu
How to Install Node.js on Ubuntu โ€“ Node Linux Installation Guide
October 20, 2023 - For updating to the latest versions of all the relevant packages, use sudo apt update in the terminal. Use your password when it asks for that. ... Now use sudo apt upgrade -y to upgrade all the upgradable packages.
๐ŸŒ
BlueVPS
bluevps.com โ€บ blog โ€บ how to install node.js on ubuntu 22.04: step-by-step guide
How to Install Node.js on Ubuntu 22.04: Step-by-Step Guide - Blog - BlueVPS
Check the Node.js and NPM version using the following commands respectively: ... If you want to install the latest Node version on your Ubuntu system, it is preferred to install Node.js from the NodeSource repository.
๐ŸŒ
Linode
linode.com โ€บ docs โ€บ guides โ€บ install-nodejs-on-ubuntu-22-04
Installing Node.js on Ubuntu 22.04 | Linode Docs
February 24, 2023 - The following steps show the simplest method to get the current Node.js implementation for Ubuntu 22.04 using the default repositories. ... This information is important, as you may need a different version of Node.js to perform a particular task. Optional: Enter the following command to install the Node Package Manager (NPM), which provides additional flexibility for Node.js management:
๐ŸŒ
PhoenixNAP
phoenixnap.com โ€บ home โ€บ kb โ€บ devops and development โ€บ how to install node.js and npm on ubuntu
How to Install Node.js and NPM on Ubuntu
April 24, 2025 - 7. Check the currently active version with the command below: ... Install Node.js and NPM from the NodeSource repository by adding the relevant PPA (Personal Package Archive) for Ubuntu...
๐ŸŒ
Vultr
docs.vultr.com โ€บ installing-node-js-and-express-on-ubuntu-20-04
Installing Node.js and Express on Ubuntu 20.04 | Vultr Docs
April 1, 2025 - To install Node.js, you can either install a more stable version of Node.js from the official Ubuntu 20.04 repositories, install the latest versions using Personal Package Archive (PPA) from NodeSource, or install using Node Version Manager (nvm).
๐ŸŒ
Reddit
reddit.com โ€บ r/node โ€บ [ubuntu] how to install a newer version of node than the one provided by apt?
r/node on Reddit: [Ubuntu] How to install a newer version of Node than the one provided by apt?
April 17, 2022 -

I installed npm with

sudo apt install npm

and then tried to use npm to install Open MCT, but I got this error:

npm ERR! notsup Required: {"node":">=14.19.1"}
npm ERR! notsup Actual:   {"npm":"7.5.2","node":"v12.22.5"}

So I figured I needed a newer version of node than the one provided by apt. So I visited https://nodejs.org/en/download/ and downloaded "Linux Binaries (x64)" containing a .tar file containing a few libraries and files.

Question: How do I install it?

EDIT: Formatting

๐ŸŒ
Quora
quora.com โ€บ How-do-I-install-Node-js-on-Ubuntu-OS
How to install Node.js on Ubuntu OS - Quora
Answer (1 of 2): Exactly like how you install all (other) software in Ubuntu which is indeed simple unless you're allergic to the keyboard. Invest in learning [code ]apt[/code], which is all you need for managing software in a Debian-family Linux distro like Ubuntu. Otherwise I think there are ot...
Top answer
1 of 2
4

I had problems with this as well. So there are many tutorials how to install different version of nodejs but they did not work in my case. However the last with nvm did.

Method 1: Install nodejs from specific source

cd ~
curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh

by changing setup_16.x to your version, you change the version

sudo bash nodesource_setup.sh

then you test sources with

# sample on Ubuntu 22.10
$ cat /etc/apt/sources.list.d/nodesource.list
deb https://deb.nodesource.com/node_16.x focal main
deb-src https://deb.nodesource.com/node_16.x focal main

Then you install nodejs from that source (did not work in my case)

sudo apt -y install nodejs

And check installed version

node -v

This should return

v16.19.0

but in my case (Ubuntu 22.10) I got the new version

v18.7.0

Method 2: Install Node Vesrion Manager or nvm This worked in my case:

sudo apt install curl 
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 
source ~/.bashrc 

Now to install an older version of nodejs with nvm

you can first check available versions by

nvm list-remote

and then install specific version by (ex. version v16.19.0)

nvm install 16.19.0

and check with:

$ node -v
v16.19.0

To install latest version of node with nvm

nvm install node 

$ node -v
v18.7.0

Hope this helps someone to

2 of 2
0

Install NVM, and the install node using nvm. Here is an example.

  1. Install nvm

     ubuntu@ip-172-26-0-227:~$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  
     Current
                                  Dload  Upload   Total   Spent    Left  
     Speed
     100 16555  100 16555    0     0   198k      0 --:--:-- --:--:-- --:--:--  199k
    
      => Compressing and cleaning up git repository
    
      => Appending nvm source string to /home/ubuntu/.bashrc
      => Appending bash_completion source string to /home/ubuntu/.bashrc
      => Close and reopen your terminal to start using nvm or run the following to use it now:
    
     export NVM_DIR="$HOME/.nvm"
     [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
     [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # 
     This loads nvm bash_completion
    
  2. Source bashrc so nvm can be loaded, or close and re open terminal.

    ubuntu@ip-172-26-0-227:~$ source /home/ubuntu/.bashrc

  3. Now, install node version, passing the version..etc.

    ubuntu@ip-172-26-0-227:~$ nvm install  v12.22.10
    Downloading and installing node v12.22.10...
    Downloading https://nodejs.org/dist/v12.22.10/node-v12.22.10-linux- 
    x64.tar.xz..100.0%
    Computing checksum with sha256sum
    Checksums matched!
    Now using node v12.22.10 (npm v6.14.16)
    Creating default alias: default -> v12.22.10
    
๐ŸŒ
CloudCone
cloudcone.com โ€บ home โ€บ how to install node.js on ubuntu 22.04
How to install Node.JS on Ubuntu 22.04 - Tutorials and How To - CloudCone
June 30, 2022 - You can install NodeJS from Ubuntu repositories, you can install from Nodesource or install NodeJS using NVM. Node.js and npm are available in the default Ubuntu repositories. As such you can easily install them using the APT package Manager.
Top answer
1 of 4
90

I recommend using Node Version Manager:

NB: Node Version Manager (nvm) allows you to install multiple node versions and choose between them depending on which software you want to support; that is, manage multiple node versions.

Installing Node Version Manager

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

Once you have Node Version Manager installed

  1. Confirm the available remote versions by running nvm ls-remote
  2. Run in your terminal nvm install <version> for example, nvm install 18 to install version 18 of Node
  3. List installed versions with nvm list
  4. Run nvm use 18 to start using version 18 of Node
  5. Note: you can be more explicit, for example: nvm install 14.17.0
2 of 4
29

Install nodejs v20 on Debian and Ubuntu based distributions

step 1 : Download and import the Nodesource GPG key

sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

step 2 : Create deb repository

NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

optional: here we are installing nodejs v20 but if you want to install v18 change NODE_MAJOR=18 in above command. Similarly if you want to install nodejs v16 then change NODE_MAJOR=16.

step 3 : Run Update and Install

sudo apt-get update
sudo apt-get install nodejs -y

congratulations you just installed nodejs

To uninstall nodejs

sudo apt-get purge nodejs &&\
rm -r /etc/apt/sources.list.d/nodesource.list &&\
rm -r /etc/apt/keyrings/nodesource.gpg