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.
🌐
Joshtronic
joshtronic.com › 2024 › 05 › 26 › ubuntu-nodejs-22-install
How to install Node.js 22 on Ubuntu - Joshtronic
If you happen to want a different version of Node.js, you can adjust the 22.x in the echo statement: % echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list · With the source repository added, we're ready to install the package.
🌐
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
It's a standard practice to install and utilize npm in conjunction with Node.js for seamless development workflows. You can install Node.js on Windows, Linux, and Mac OS. In this tutorial, we will demonstrate how to install Node.js on Ubuntu 22.04 using different methods.
🌐
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 ...
🌐
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 - Discover two methods to install the latest Node.js version on Ubuntu 22.04. Use PPA and nvm to set up Node.js on your Ubuntu server.
🌐
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.
🌐
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:
Find elsewhere
🌐
Hostman
hostman.com › tutorials › how to install node.js on ubuntu 22.04
Installing Node.js on Ubuntu 22.04
July 2, 2025 - In this simple guide, we described how to install Node.js on Ubuntu 22.04 using three different methods.
Price   $
Address   1999 Harrison St 1800 9079, 94612, Oakland
🌐
OVHcloud
ovhcloud.com › tutorials › how to install node.js on ubuntu 22.04
How to install Node.js on Ubuntu 22.04 ? | OVHcloud Worldwide
In this tutorial, you will learn how to install a Node.js platform on an Ubuntu 22.04 Linux distribution.
🌐
Cherry Servers
cherryservers.com › home › blog › linux › how to install node.js on ubuntu 22.04 | step-by-step
How to Install Node.js on Ubuntu 22.04 | Cherry Servers
June 5, 2023 - This step-by-step tutorial will show you three different ways to install Node.js on Ubuntu 22.04, including instructions on how to set up the Node.js environment.
🌐
Vultr
docs.vultr.com › how-to-install-nodejs-and-npm-on-ubuntu-2204
How to Install Node.js and NPM on Ubuntu 22.04 | Vultr Docs
April 29, 2025 - Learn to install Node.js and NPM on Ubuntu 22.04 using NodeSource PPA and manage versions with NVM efficiently.
🌐
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
🌐
RoseHosting
rosehosting.com › home › how to install node.js on ubuntu 22.04
How to Install Node.js on Ubuntu 22.04 | RoseHosting
March 21, 2023 - In this tutorial, we are going to explain in step-by-step detail how to install and use Nodejs on Ubuntu 22.04 OS.
🌐
SW Hosting
swhosting.com › en › blog › how-to-install-nodejs-on-ubuntu-2204
How to install NodeJS on Ubuntu 22.04 - SW Hosting's Blog
August 14, 2024 - In this post, I'll walk you through the steps required to install Node.js on a machine running Ubuntu 22.04.
🌐
AlexHost
alexhost.com › home › faq или база знаний › how to install node.js on ubuntu 22.04
How to Install Node.js on Ubuntu 22.04 ⋆ ALexHost SRL
February 4, 2025 - You now know three different methods to install Node.js on Ubuntu 22.04: using the default Ubuntu repositories, installing from the NodeSource PPA, and using Node Version Manager (NVM).
🌐
TechOverflow
techoverflow.net › 2025 › 02 › 09 › how-to-install-nodejs-22-x-lts-on-ubuntu-in-1-minute
How to install NodeJS 22.x LTS on Ubuntu in 1 minute | TechOverflow
February 8, 2025 - 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 NODE_MAJOR=22 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 sudo apt-get update sudo apt-get install nodejs -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
🌐
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 (-> N/A) lts/fermium -> v14.19.3 lts/gallium -> v16.15.0
🌐
Reintech
reintech.io › blog › install-nodejs-npm-ubuntu-22
Installing Node.js and NPM on Ubuntu 22 | Reintech media
March 11, 2024 - Learn the step-by-step process of installing Node.js and NPM on Ubuntu 22. Find out how to use the Ubuntu repository, NodeSource PPA, and NVM to manage Node.js versions.