npm Download, Install and Usage Tutorial
npm or nodejs package manager. npm provides easily install, update and remove packages and load libraries according to the application configuration.
Install Npm Package For Ubuntu, Debian, Mint, Kali
We can install
npm package with the
apt command where Ubuntu, Debian, Mint, Kali distributions support.
$ sudo apt install npm
Install Npm Package For Fedora, CentOS, RedHat
yum based distributions we will use
dnf command like below where we will install
$ sudo yum install npm
$ sudo dnf install npm
Print npm General Help Information
npm command provides different type of commands or options in order to manage nodejs packages. We can get general information about these command with the
$ npm -h
Get Specific Command or Option Help For npm
In the previous example, we have listed generic information about the npm commands and options. We may need a more detailed help about these commands or options which can be listed with the
COMMAND -h . In this example, we will list detailed help about the
$ npm search -h
Search For A Packages with npm
We can search for a specific package for installation with the
search command or option. In this example, we will search the term
$ npm search angular
We can see that search results are printed and listed in a structured column. This search results will present the following information.
NAMEis the package full name like
DESCRIPTIONis the info about the package what is it.
AUTHORis the package create a name or team name.
DATEis the last time the package is updated.
VERSIONis the version number of the package which is latest.
KEYWORDSare some tags which describe and related to the package.
Install Single Package with npm
We can install packages with the
install npm command or options by providing the package full name. In this example, we will install the package named
$ npm install angular
We can see that after the package installation is complete the installed package name with is
angular and the version installed which is
1.7.8 are printed to the console.
Install All Project Dependencies in package.json with npm
package.json provides the list of the packages which is required for a project. In order to run this project, the packages should be installed.
npm command can install packages listed in this
"description": "A sample Node.js app using Express 4",
"start": "node index.js"
"author": "Mark Pundsack",
"Zeke Sikelianos <firstname.lastname@example.org> (http://zeke.sikelianos.com)"
We can simply use
install command which will automatically look for
package.json and install required packages.
$ npm install
Update Packages with npm
Updating packages with the npm is easy as installing of them. We will provide the package name we want to update to the
update command or option. In this example, we will update the package named
$ npm update angular
i option and provide the package name as
npm like below.
$ npm i npm
We can see from the output that the current version is updated to the 6.9.0 .
Print Package Details with npm
npm package information can be listed with the
view command. We will also provide the package name. In this example, we will list and print information about the
$ npm info angular
We can see that the following information about the package is provided.
nameis the package full name.
descriptionis short information about the package.
latestis the latest version of the package.
readmeFilenameis the name of the README.
homepageis the official home page of the package.
keywordsis related tags and keywords with the package.
licenseis a usage license.