To install Node.js and NPM on Ubuntu, follow the steps mentioned below:
Step 1 – Install Node
Open your terminal and run the following commands.
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
Then, install Node.
sudo apt-get install -y nodejs
Step 2 – Verify the Installation
Run the following command to verify the Node installation.
node -v
This should result in the Node version installed in your system.
Verify the NPM installation.
npm -v
Step 3 – Install build tools
Install the optional build tools for native addons.
sudo apt-get install -y build-essential
That’s it. You have installed the Node.js in your Ubuntu system.