To update nodejs to 14.x run the following commands:

sudo apt update
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt install -y nodejs
node -v

After running the final command you should see:

v14.15.0
Answer from Ahmed Boutaraa on askubuntu.com
Top answer
1 of 6
61

To update nodejs to 14.x run the following commands:

sudo apt update
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt install -y nodejs
node -v

After running the final command you should see:

v14.15.0
2 of 6
18

Update for 2024

Since this question was posted, version 20 became the newest LTS version. So Ahmed Boutaraa's answer was correct for the version 14 part of the question, but people stumbling on this question may be seeking the most recent LTS. If you follow those instructions, you will be stuck in version 14.

Luckily, NodeSource also provides an installation script that installs the current LTS rather than a specific version. That should make this answer a bit more future-proof. You can also get the same info straight from the source.

As an aside, there is a script called nvm that is great for managing your node version. It makes it easy to install multiple versions, like if you work with multiple projects with different version requirements or if you want to experiment with the latest version and easily switch back to LTS for regular work. You can find installation instructions on their repository.

How to install the latest LTS version

This set of instructions will install whatever version is the latest LTS version. When a new version is released, you may have to run these instructions again to pull the new install script for the new version.

# As a user with sudo
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

# OR as root
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs

How to install the latest non-LTS version

This set of instructions will install whatever version is the latest non-LTS version. When a new version is released, you may have to run these instructions again to pull the new install script for the new version.

# As a user with sudo
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs

# OR as root
curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs

How to lock into v21 (latest, for now)

# As a user with sudo
curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash -
sudo apt-get install -y nodejs

# OR as root
curl -fsSL https://deb.nodesource.com/setup_21.x | bash -
apt-get install -y nodejs

How to lock into v20 (current LST)

# As a user with sudo
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs

# OR as root
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
🌐
Joshtronic
joshtronic.com › 2023 › 04 › 23 › how-to-install-nodejs-20-on-ubuntu-2004-lts
How to install Node.js 20 on Ubuntu 20.04 LTS - Joshtronic
April 23, 2023 - First, I always like to make sure my system is up to date and that we have curl installed: $ sudo apt update $ sudo apt upgrade $ sudo apt install -y curl · With the system and the necessarily dependencies ready to go, we can grab the setup script for Node.js 20 and give it ...
Discussions

upgrade - Upgrading Node.js to the latest version - Stack Overflow
So, I have Node.js installed and now when I tried to install Mongoosejs, I got an error telling me that I don't have the needed version of Node.js (I have v0.4.11 and v0.4.12 is needed). How can I More on stackoverflow.com
🌐 stackoverflow.com
How to update node on my WSL Ubuntu?
In general, for your local setup, I would recommend to use NVM https://github.com/nvm-sh/nvm More on reddit.com
🌐 r/node
8
1
April 21, 2024
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 ... More on stackoverflow.com
🌐 stackoverflow.com
How do I update the node version to 20.9.0
Following the tutorial https://www.digitalocean.com/community/tutorials/how-to-deploy-a-nestjs-application-with-nginx-on-ubuntu. To fulfill the prequesit of installing node I used the command: sudo apt install nodejs This installed node 18.19.1. On my local machine I am using 20.9.0. More on digitalocean.com
🌐 digitalocean.com
2
May 19, 2024
🌐
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 - The best way to install Node.js on Ubuntu 20.04 is to use a package manager like NVM (Node Version Manager) or a NodeSource PPA. These methods provide more flexibility and allow for easy version management. ... # Install Node.js using NVM nvm install node # Install Node.js using NodeSource PPA sudo apt update && sudo apt install nodejs...
🌐
NodeSource
nodesource.com › blog › Update-Node.js-versions-on-linux
How to Update Node.js Versions on Linux
January 31, 2025 - Download the latest Node.js binary: curl -fsSL https://nodejs.org/dist/latest/node-v23.8.0-linux-x64.tar.xz -o node.tar.xz ... Update your system’s PATH: echo 'export PATH=/usr/local/nodejs/bin:$PATH' >> ~/.bashrc source ~/.bashrc
Top answer
1 of 16
1868

Ubuntu Linux/Mac

The module n makes version-management easy:

sudo npm install n -g

For the latest stable version:

n stable

For the latest version:

n latest

Debian 10

Upgrade older versions of node and npm on Debian 10 as follows:

sudo su -c 'curl -sL https://deb.nodesource.com/setup_18.x | bash -'
sudo apt-get install nodejs -y
sudo apt update
sudo apt upgrade
sudo npm install -g [email protected]
node --version
npm --version

Note: Replace setup_18 with the latest long-term support release.

Windows

Just reinstall node from the .msi in Windows from the node website.

2 of 16
839

All Platforms (Mac, Linux & Windows) 2024

If you just need to upgrade your old version of Node.js to the latest one and don't need multiple versions, simply over-write your existing executable with the new one.

Download the Latest Node.js from nodejs.org/en/download

This Just Works! TM on all platforms and is the easiest/fastest method.
When you run node -v in your terminal you will see the the latest version.

Mac

If you originally installed Node.js using brew then run:

brew upgrade node

Managing Multiple Versions of Node.js:

If you need to run multiple versions of Node.js on your machine e.g. if you have an older project that targets a specific version on AWS Lambda, then NVM (Node Version Manger) is your friend!

Step 1 - Get NVM

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

If you're curious about the installation command read the source code
... its been reviewed by several node.js security experts

Step 2 - Install the Specific Version of Node.js you need

Once you've got NVM you can install a specific version of Node.js using the nvm command:

nvm install v22.16.0

Note: you may need to close & re-open your terminal window for nvm command to be available.

You should expect to see something like this in your terminal:

Now using node v22.16.0

You now have the latest Node.js on your machine.
And if you need to temporarily switch to a different/previous version, you can do it with a simple nvm command.

Note: avoid using sudo with Node/NPM as it violates the security principal of least privilege

NVM is considered "better" than N for managing multiple Node.js versions because the verbose commands mean it is much easier to keep track of what you are doing in your Terminal/SSH Log. It is used by the team at NPM the creators/custodians of the Node.js World!

🌐
Medium
medium.com › @nsidana123 › before-the-birth-of-of-node-js-15ee9262110c
How To Install Node.js 20 LTS on Ubuntu 22.04|20.04|18.04 | by Navdeep Sidana | Medium
December 7, 2023 - This guide has demonstrated how you can start the installation of Node.js 20 LTS on Ubuntu Linux system. As seen in this article, the process is straightforward and doesn’t required any special Linux skills. By following and customizing on the steps provided, you should be able to develop more complex applications by adding extra functionality and features. We hope this article was of great help. Follow us on our social media platforms for more juicy updates. Nodejs ·
🌐
Reddit
reddit.com › r/node › how to update node on my wsl ubuntu?
r/node on Reddit: How to update node on my WSL Ubuntu?
April 21, 2024 -

I have downloaded node on my win and it shows 20.11.1 while using node -v command. but when I use the same command on wsl ubuntu it shows v10.19.0. how to update it on wsl?

installed node using sudo apt install node

Find elsewhere
🌐
It's FOSS
itsfoss.com › upgrade-node-ubuntu
Properly Upgrade Node.js to a Newer Version in Ubuntu
February 28, 2024 - At the time of writing this, for Ubuntu 22.04 and Debian 12 Bookworm, Node.js version 18, 20, and 21 are supported. Node provides a script for each active major version. You just have to replace YY with the version you want in the following command: curl -fsSL https://deb.nodesource.com/setup_YY.x | sudo -E bash - Let’s say you have installed version 18 of Node.js using the NodeSource repository, and you want to update it to version 21.
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
🌐
DigitalOcean
digitalocean.com › community › questions › how-do-i-update-the-node-version-to-20-9-0
How do I update the node version to 20.9.0 | DigitalOcean
May 19, 2024 - https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04#option-2-installing-node-js-with-apt-using-a-nodesource-ppa · First, install the PPA to get access to its packages.
🌐
Vultr
docs.vultr.com › how-to-upgrade-a-node-js-version-on-ubuntu
How to Upgrade Node.js Version on Ubuntu Complete Guide | Vultr Docs
May 22, 2025 - This method upgrades Node.js by adding the official NodeSource repository and is ideal for system-managed environments or automated server setups. Download and run the NodeSource setup script. Replace <version> with the major version number ...
🌐
BitLaunch
bitlaunch.io › blog › how-to-install-node-js-to-ubuntu-20-04
Five ways to install Node.js on Ubuntu 20.04
August 22, 2024 - Learn five ways to install Node.js on Ubuntu 20.04, from apt to NVM and Docker.
🌐
GitHub
gist.github.com › adityaka › cc2ffefba6dd9b3275e390157a3bcba4
Upgrading from node 12 to node 14 on Ubuntu 20 LTS · GitHub
Unpacking nodejs (14.20.0-deb-... and node js sudo apt remove libnode-dev nodejs · update the repositories if needed sudo apt update · install nodejs sudo apt install nodejs · Copy link · Hi @adityaka , Thank ...
🌐
Medium
safaetulahasan.medium.com › how-to-install-nodejs-on-ubuntu-20-04-lts-ec10c0829429
How to install and update Nodejs on Ubuntu 20.04 LTS | by Safaetul Ahasan | Medium
September 10, 2022 - How to install and update Nodejs on Ubuntu 20.04 LTS Using Command Install Specific Nodejs version. Download tar.xz the file then install it. Update Nodejs: Uninstall NodeJs. Uninstall the previous …
🌐
Node.js
nodejs.org › en › download
Node.js — Download Node.js®
Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.
🌐
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 - If you installed Node.js via apt ... https://deb.nodesource.com/setup_20.x | sudo -E bash - Then, update your package list and upgrade the nodejs package: sudo apt update ·...
🌐
{app_name}/
camkode.com › posts › installing-nodejs-20-on-ubuntu-step-by-step-guide
Installing Node.js 20 on Ubuntu: Step-by-Step Guide
Installing Node.js on Ubuntu can ... step-by-step guide to installing Node.js version 20 on Ubuntu. sudo apt-get update && sudo apt-get install -y ca-certificates curl gnupg...
🌐
SitePoint
sitepoint.com › blog › javascript › quick tip: install node.js on ubuntu
Quick Tip: Install Node.js on Ubuntu — SitePoint
October 22, 2023 - To install Node.js 20 on Ubuntu ... window: sudo apt update, sudo apt upgrade, sudo apt install -y curl, curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -, and sudo apt install -y nodejs....
🌐
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 - This version is no longer actively supported and will not receive security updates. The installation is straightforward. Run the following commands to update the package index and install Node.js and npm: sudo apt updatesudo apt install nodejs npm ·