Installing the latest version of node using nvm:

Install the latest nvm through its Github repo:

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

source ~/.bashrc

check the latest version of node and select it:

nvm list-remote

Out:

...
       v20.15.0   (LTS: Iron)
       v20.15.1   (LTS: Iron)
       v20.16.0   (Latest LTS: Iron)
        v21.0.0
        v21.1.0
        v21.2.0
        v21.3.0
        v21.4.0
        v21.5.0
        v21.6.0
        v21.6.1
        v21.6.2
        v21.7.0
        v21.7.1
        v21.7.2
        v21.7.3
        v22.0.0
        v22.1.0
        v22.2.0
        v22.3.0
        v22.4.0
        v22.4.1
        v22.5.0
        v22.5.1
        v22.6.0

Install the desired version of node:

nvm install v20.16.0
Answer from Benyamin Jafari on askubuntu.com
🌐
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 - This guide provides detailed instructions for installing Node.js on an Ubuntu 22.04 server using three different methods. It starts with the basic method of using apt to install Node.js from the default repositories, suitable for most users who need a stable version.
🌐
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 - Learn how to install Node.js on Ubuntu using apt, NodeSource, and NVM. Choose the best method for your needs with this beginner-friendly guide
🌐
ComputingForGeeks
computingforgeeks.com › home › how to › install node.js 12 on ubuntu / debian / linux mint
Install Node.js 12 on Ubuntu / Debian / Linux Mint | ComputingForGeeks
August 18, 2023 - Running the following commands is all that’s needed for the installation. sudo apt -y install nodejs npm · You can as well install development tools used to build native addons: sudo apt -y install gcc g++ make · Confirm Node.js 12 installation ...
🌐
Cloudlaya
cloudlaya.com › blog › install-node-js-12-on-ubuntu-debian-linux
Install Node.js 12 on Ubuntu / Debian / Linux - Cloudlaya | Blog
February 23, 2022 - Learn how to Install Node.js 12 on Ubuntu / Debian / Linux and setup your own Virtual private server by yourself.
🌐
Liquid Web
liquidweb.com › home › how to install node.js on ubuntu 22.04 via nvm
How to Install Node.js on Ubuntu 22.04 via NVM | Liquid Web
February 19, 2025 - Similarly, install an older LTS release run the nvm install –lts=erbium command: ... nvm ls -> v12.22.12 v14.21.2 (LTS: Fermium) v16.19.0 (LTS: Gallium) v18.13.0 system default -> node (-> v18.13.0) (default)
🌐
CodeGenes
codegenes.net › blog › how-can-i-install-node-js-version-18-on-ubuntu-22-04
How to Install Node.js 18 on Ubuntu 22.04: Fix 'Old Version (v12.22.9) Installed' Issue — codegenes.net
If you’ve tried installing Node.js on Ubuntu 22.04 using sudo apt install nodejs and encountered the "old version (v12.22.9)" issue, this guide will walk you through uninstalling the outdated version and installing Node.js 18 (a long-term ...
Find elsewhere
🌐
Node.js
nodejs.org › en › download
Node.js — Download Node.js®
InfoWant new features sooner? Get the latest Node.js version instead and try the latest improvements! BashCopy to clipboard and their installation scripts are not maintained by the Node.js project.
🌐
Relia Software
reliasoftware.com › blog › install-nodejs-on-ubuntu-22-04
How to Install Node.js on Ubuntu 22.04? | Relia Software
February 27, 2024 - 3 methods for installing Node.js on Ubuntu 22.04: with Ubuntu Package Manager; with NVM (Node Version Manager); and from Official Node.js Binary Distributions.
Price   $$$$$
Address   629 Nguyen Kiem, Ward 9, Phu Nhuan District, 700000, Ho Chi Minh
🌐
VSYS
vsys.host › how-to › how-to-installing-node-js-on-ubuntu-22-04
How to Install Node.js on Ubuntu 22.04 ★ VSYS Tutorials
June 20, 2024 - It is technically obsolete, but it should be supported until Ubuntu 24.04. You can obtain this version by using the apt package manager. First, refresh your local package index by typing: ... When prompted to confirm installation, press Y.
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
🌐
Node.js
nodejs.org › en › blog › release › v12.22.1
Node.js — Node.js v12.22.1 (LTS)
Windows 32-bit Installer: https://nodejs.org/dist/v12.22.1/node-v12.22.1-x86.msi Windows 64-bit Installer: https://nodejs.org/dist/v12.22.1/node-v12.22.1-x64.msi Windows 32-bit Binary: https://nodejs.org/dist/v12.22.1/win-x86/node.exe Windows 64-bit Binary: https://nodejs.org/dist/v12.22.1/win-x64/node.exe macOS 64-bit Installer: https://nodejs.org/dist/v12.22.1/node-v12.22.1.pkg macOS 64-bit Binary: https://nodejs.org/dist/v12.22.1/node-v12.22.1-darwin-x64.tar.gz Linux 64-bit Binary: https://nodejs.org/dist/v12.22.1/node-v12.22.1-linux-x64.tar.xz Linux PPC LE 64-bit Binary: https://nodejs.org
🌐
Linuxize
linuxize.com › post › how-to-install-node-js-on-ubuntu-20-04
How to Install Node.js and npm on Ubuntu 20.04 | Linuxize
December 24, 2023 - In this tutorial, we will guide you through three different methods of installing Node.js and npm on Ubuntu 20.04:
🌐
npm
docs.npmjs.com › downloading-and-installing-node-js-and-npm
Downloading and installing Node.js and npm | npm Docs
To publish and install packages to and from the public npm registry or a private npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. We strongly recommend using a Node version manager like nvm to install Node.js and npm.
🌐
Pi My Life Up
pimylifeup.com › home › how to install node.js on ubuntu
How to Install Node.js on Ubuntu - Pi My Life Up
September 10, 2024 - In this tutorial, we will be walking you through the steps to install Node.js on Ubuntu.
🌐
Linuxize
linuxize.com › post › how-to-install-node-js-on-ubuntu-22-04
How to Install Node.js and npm on Ubuntu 22.04 | Linuxize
December 24, 2023 - To install the latest available version of Node.js, run: ... -> v14.19.3 v16.15.0 v18.2.0 default -> node (-> v18.2.0) iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v18.2.0) (default) stable -> 18.2 (-> v18.2.0) (default) lts/* -> lts/gallium (-> v16.15.0) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 (-> N/A) lts/dubnium -> v10.24.1 (-> N/A) lts/erbium -> v12.22.12 ...