How to Install NodeJs on Ubuntu

Creating frontend and web-based applications node.js is one of the most popular choices. In order to install node.js we need to decide about the version that we want to install. There are a couple of versions available

  • 13.x
  • 12.x (LTS)
  • 10.x

For this project, we will use version 12.x of node.js. To start the installation we need to add the repository key and the repository URL to the system. All these steps are handled by node.js’s official script.

curl -sL | sudo -E bash -

NodeJs Initial Script

This will download the initialization script and add the required package info to the system. If asked for a password please provide sudo password.

Now, to install node.js 12.x run the following command

sudo apt-get install -y nodejs

This will install node.js and npm (node package manager). Verify the installation with

node --version


npm --version

If everything were okay and node.js has been installed correctly, the output should be similar as below (although the version may differ).

Install NodeJs


Leave a Comment