npm Download, Install and Usage Tutorial – POFTUT

npm Download, Install and Usage Tutorial

nodejs is a popular javascript platform and framework which provides server and client-side libraries. What makes nodejs so successful is its package manager named 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.

Install Npm Package For Ubuntu, Debian, Mint, Kali

Install Npm Package For Ubuntu, Debian, Mint, Kali

Install Npm Package For Fedora, CentOS, RedHat

For yum based distributions we will use yum or dnf command like below where we will install npm package.

OR

Install Npm Package For Fedora, CentOS, RedHat

Install Npm Package For Fedora, CentOS, RedHat

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 -h option.

Print npm General Help Information

Print npm General Help Information

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 searchcommand.

Get Specific Command or Option Help For npm

Get Specific Command or Option Help For npm

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 angular.

Search For A Packages with npm

Search For A Packages with npm

We can see that search results are printed and listed in a structured column. This search results will present the following information.

  • NAME is the package full name like angular, angular-strap etc.
  • DESCRIPTION is the info about the package what is it.
  • AUTHOR is the package create a name or team name.
  • DATE is the last time the package is updated.
  • VERSION is the version number of the package which is latest.
  • KEYWORDS are some tags which describe and related to the package.
LEARN MORE  How To Install Gulp with Npm

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 angular.

Install Single Package with npm

Install Single Package with npm

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 package.json easily.

We can simply use install command which will automatically look for package.json and install required packages.

LEARN MORE  How To Install Gulp with Npm

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 angular.

Update nmp

Update nmp 

Update nmp 

npm can install and update different JavaScript libraries. npm can also update itself like a normal package. We will use i option and provide the package name as npm like below.

Update npm

Update 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 info or view command. We will also provide the package name. In this example, we will list and print information about the angular package.

Print Package Details with npm

Print Package Details with npm

Print Package Details with npm

Print Package Details with npm

We can see that the following information about the package is provided.

  • name is the package full name.
  • description is short information about the package.
  • latest is the latest version of the package.
  • readmeFilename is the name of the README.
  • homepage is the official home page of the package.
  • keywords is related tags and keywords with the package.
  • license is a usage license.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)