How to Install Node.js on Ubuntu 22.04 LTS
If you want to install Node.js on Ubuntu 22.04 LTS, follow these steps:
Step 1: Update & Upgrade
Open a terminal and run the following commands:
sudo apt update
sudo apt upgrade
Step 2: Install Node.js
Run the following command to install Node.js:
sudo apt install nodejs
Step 3: Install NPM
Run the following command to install NPM:
sudo apt install npm
Step 4: Verify Installation
To verify that Node.js and NPM are installed, run the following commands:
node --version
npm --version
Step 5: Configure Node.js and NPM
If you need to configure Node.js and NPM, you can use the npm config command.
For example, to set the default package scope for NPM, use:
npm config set scope=@yourusername
Uninstall Node.js on Ubuntu
If you ever need to uninstall Node.js from your Ubuntu system, you can do so by running the following command:
sudo apt remove nodejs
That’s it! You now have Node.js and NPM installed on your Ubuntu 22.04 LTS system. Happy coding!