How to Install Stable Node JS on Ubuntu
To install the stable version of Node.js on Ubuntu, you can follow these steps:
1. Update the package lists for upgrades and new package installations:
sudo apt update
2. Install the required dependencies for Node.js using the package manager:
sudo apt install curl dirmngr apt-transport-https lsb-release ca-certificates
3. Add the Node.js repository to your system by importing the repository’s GPG key:
curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
Note: This command adds the LTS (Long Term Support) version of Node.js. If you want the latest stable release, you can use “setup_current.x” instead of “setup_lts.x”.
4. Once the repository is added, you can proceed to install Node.js:
sudo apt install nodejs
5. Verify that Node.js is installed correctly by checking its version:
node -v
6. Additionally, you can verify the installed version of npm (Node Package Manager) by running:
npm --v
That’s it! You have successfully installed the stable version of Node.js on Ubuntu.