The “npm (Node Package deal Supervisor)” is utilized to set up numerous node packages and dependencies. Practically all the node deals are offered on the world’s greatest deal supervisor registry.
We have a number of sources to obtain the Node.js and npm on Ubuntu 20.04, but why not pick the easy strategies.
In this tutorial, we will see the two approaches for installation:
- Install Node.js and npm from Ubuntu Formal Repository
- Set up Node.js Employing nvm
Let us start:
How to Install Node.js and npm from Ubuntu Official Repository
To obtain Node.js and npm from Ubuntu’s repository is a quite clear-cut and simplest way. What we require to do is, open up the terminal and update all the package index of the Ubuntu procedure:
Operate the pursuing command to install the Node.js environment with all the important offers on Ubuntu machine:
When completed, confirm if the installation has completed by examining its variation:
As a result of the Ubuntu official repository, the installed node.js is the hottest accessible package deal. It is not obligatory to go with it if you want to put in the particular just one, then go toward the 2nd approach in this guide.
To install the npm library on the procedure is as uncomplicated as we have installed the node.js. Compose the presented command to initiate the installation approach of the npm in the command line:
The Node.js and the npm library have been mounted on the process from the Ubuntu official repository.
How to Put in Node.js working with nvm
In the higher than section, we have viewed that via the Ubuntu repository, only the most current accessible package of Node.js can be set up. To get the particular version of Node.js on a process, down load it through nvm that is the abbreviated form of “Node Version Manager”. As the identify describes, it is the bash script consist of all node variations and will allow the person to put in and examination any Node.js version as per need.
To get the download website link, you can stop by https://github.com/nvm-sh/nvm#installing-and-updating, or you can copy the mentioned curl command in the terminal:
$ curl –o- <a href=“https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh”>https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/set up.sha> | bash
You may experience this challenge, and to solve this, install the curl command:
Now, operate the above curl command of node.js all over again to get started nvm set up:
To supply the bash file, run the presented command:
Operate the stated command to present the list of Node.js offered versions:
Use the following syntax to put in the edition you want:
$ nvm put in [version_number]
For occasion, to install the node version “v10.24.1”, the command would be:
To look at the checklist of all node variations set up on Ubuntu device, the command is:
How to Uninstall Node.js from Ubuntu 20.04
If you want to uninstall the Node.js from the procedure, use the stated command:
This produce-up displays how to install Node.js and npm on Ubuntu 20.04 employing Ubuntu repository and nvm procedures.