How to Download & Install Node.js on Ubuntu

Node.js is open sourced JavaScript. This helps us to execute the codes of JavaScript. This execution will be happened from the server-side. It means we can able to run the codes of the JavaScript as the standalone apps. This is very much popular like full stack as well as front-end solutions.

The package manager of Node.js is NPM which is default. This is world’s largest registry of software.

In this article we are going to see how to download and install the Node.js & npm. Especially on the Ubuntu using different methods. Using the same method, we can also able to install the Node.js in Linux Mint, Kubuntu & OS.

If we need to use the Node.js as the local runtime to deploy the node.js app? Then the best option is by downloading from the NodeSource. But most of the developers prefer to download from NVM Script.

We need to choose the best option for downloading as well as installing the Node.js based on our need & environment. Now we discuss in detail about it.

Downloading and Installing the Node.js using the NodeSource:

Company which focus on delivering the enterprise-oriented Node support for the industry is the NodeSource. They are maintaining the repository. This contains the updated as well as latest version of the node.js. With the help of this repository we can able to install any versions of the Node.js. When we start writing, it will display all the versions. We can choose anyone based on our needs.

For downloading and installing the node.js using the NodeSource, we should follow the below steps.

  1. We need to run the curl as the user with the sudo privilege. This is for enabling the repository of the NodeSource.

So that, this command is helpful for adding the NodeSource sign in keys for our system. Then we need to create the repository files of apt source. After that, we need to install all the required packages. Finally, we need to refresh the cache of the apt. 

We can able to install the other version of the Node.js. We can just want to change setup_10.x with the necessary version.

  1. After we enable the repository of the NodeSource. We can able to install the Node.js & npm just by typing the following. 

The package of the nodejs will contain both node as well as npm binaries.

  1. We can able to verify whether the Node.js is installed successfully or not. This is possible just by printing the versions.

Downloading and Installation the Node.js using the NVM:

NVM is the bash scripts. This is generally used for managing many numbers of active version of the Node.js. Using this NVM, we can able to install as well as uninstalling any versions of the Node.js. 

For installing the Node.js with the help of NVM on Ubundu, we need to follow the following steps. 


  1. Install the NVM Script:

We need to run the below command for downloading as well as installing the NVM.

This command will clone repository of the NVM from the Github to .nvm directory.

The output which is shown above mentioned two ways. First way is we need to close & reopen terminal. The second way is we can able to run commands for adding path to the NVM scripts for current shell. We can able to choose either of the two ways which we feel as easy. 

We can able to check whether NVM is installed properly or not. This is possible just by using the below commands.


  1. Install the Node.js:

As of now we have successfully installed our NVM in the Node.js. This is done with the help of the below command.

The output is shown below.

After the completion of the installation, we can able to verify it. This is possible with the help of printing the versions of Node.js.

There are another two more versions available. They are LTS version & version 8.10.0.

For displaying the version type of Node.js, we need to use the following command.

The output will be displayed below.

The details which starts with the arrow which is on right is the version of the Node.js. This version is our current version of the Node.js which is installed in our system. 

We can able to change our current version. 

This is possible with the following command.

Installing the Node.js using the repository of the Ubuntu:

The Node.js is straightaway from default repository of the Ubuntu. v8.10.0 is the current version available. This is the previous version of TLS. 

For installing the Node.js & NPM we should run the below command.

These executables are named as nodejs rather than named as node. This is because of the conflict with the other packages.

We can able to verify the Node.js installation just by executing the below command.

Installing the development tools:

We can compile as well as install the add-ons of npm. For this we want to install all development tools. 

We can able to achieve this with the help of the below command. This will install the needed packages along with GCC compilers.

Uninstalling the Node.js:

For any reason if we want to uninstall this then we should use the below command.

Conclusion:

In this article we have discuss about the installation of Node.js. This is with the help of three ways. We can choose any one method based on our dependencies. Comparatively, installing from Ubuntu is very easy. Hope this article validates your time. Based on the commands mentioned in this article we can able to install the Node.js.

February 4, 2020
© 2023 Hope Tutors. All rights reserved.

Site Optimized by GigCodes.com

Request CALL BACK