To install Node.js on Ubuntu via the terminal, you can use the following commands:
1. Update the package list: To get the most recent package details, use the command
sudo apt update.
2. Install Node.js and npm: Use the command
sudo apt install nodejs npm
to install both Node.js and npm.
3. Verify the installation: Use the command
node -v
npm -v
to check the version of Node.js that is installed.
---------------------------------------
In my case :
node -v
v18.19.1
npm -v
9.2.0