How to install node js version 18 on ubuntu 22.04 ?
cd ~
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install nodejs
I tried these commands many times, but always version v12.22.9 is installed.
To build an app with React, I need Node 14 or higher.
What do you recommend ?
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
nvm ls-remote
nvm install <version>
for example, nvm install 18
to install version 18 of Nodenvm list
nvm use 18
to start using version 18 of Nodenvm install 14.17.0