Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to install a latest version of Nodejs on Ubuntu? [duplicate]

Tags:

node.js

ubuntu

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 install nodejs. Then I re-install my node but before re-install I update my system using sudo apt update && sudo apt upgrade. But i keep getting same result. node version v12.22.9.

like image 390
Dika Avatar asked Sep 02 '25 10:09

Dika


1 Answers

The current LTS version can be installed via

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

In difference to the already provided answers, this evergreen link will always install the current long term supported version. So you don't need to tweak your script every couple month.

like image 73
The Fool Avatar answered Sep 04 '25 01:09

The Fool