Install Node.js in Ubuntu 19.10

Node.js is a free and open-source JavaScript runtime environment. It is built on V8 JavaScript engine of Chrome. In this article, we would focus on how to install Node.js in Ubuntu 19.10 release. Node.js was first released on May 27, 2009. And, at the time of writing the article, latest Long-term Support (LTS) release available is 12.13.0. It is supported till April 30, 2022.

Furthermore, we have got two methods through which we could install Node.js in our Ubuntu release.

Either we can install it through standard Ubuntu repository or it could be done through package available from the official website itself. But, it is worth mentioning here that LTS version available in the standard Ubuntu repository may be different from the one you get from the official website.

Note: Following operations would require you to have superuser privileges. In case you don’t have one, then contact your System Administrator for assistance.

Method: I – Install Node.js in Ubuntu 19.10 through Ubuntu repository

Installing Node.js through standard Ubuntu repository is pretty straight-forward. Open a terminal and issue the following –

sudo apt update
sudo apt install nodejs

First, we have updated the repository to make the latest version of the package available. Thereafter, package i.e. Node.js was installed.

To verify whether the package has successfully installed, run either of the following –

node -v
nodejs -v

It would return with the version of the package installed. In our case, we could install version 10.15.2.

Alternately, we can also download & install the latest LTS version from the official website too.

Method: II – Install Node.js (Linux Binaries) in Ubuntu 19.10

We need to first download the Linux Binaries (x64) package from the Downloads section on Nodejs official website.

The package is of our around 13.4 MBs in size. And, the file downloaded would be – node-v12.13.0-linux-x64.tar.xz. As already mentioned, the latest LTS version is 12.13.0.

Now, we would extract the downloaded file through tar command-line utility. Hence,

tar -xvf node-v12.13.0-linux-x64.tar.xz

It would create a directory node-v12.13.0-linux-x64.

Now, open ~/.bashrc file using a text editor like nano –

nano ~/.bashrc

and, append the file with the following –

export PATH=/path/to/node-v12.13.0-linux-x64/bin:$PATH

where, /path/to/ should be replaced.

Next, open a terminal –

node -v

It would return with the version installed i.e. v12.13.0

But, it would still be inaccessible to root. Therefore, we would create a symbolic link to make it accessible.

sudo ln -s /path/to/node-v12.13.0-linux-x64/bin/node /usr/bin/node

Login as root or sudo -i to verify –

node -v

It should also return with the version of Node.js installed.

In conclusion, we have discussed how to install Node.js in Ubuntu 19.10. In next article, we have discussed how to Install and use NPM in Ubuntu 19.10.

Similar Posts