i

Node Package Manager

NPM repository has a collection of modules that we can download and use in our application. Apart from a set of built-in modules, we have a large set of modules already created to be used by applications as per requirement.

We can install and uninstall modules as per our requirement.

For installing any module to the project :

D:\node-demo> npm install

 or

D:\node-demo> npm I

For downloading a Test Library chai:

Not only, does npm help in installation, update and uninstallation of modules, it also makes project transportation easier.

As most of the enterprise applications will be built using a large set of modules, sending all modules is not a practical solution.

We create a package.json file for keeping metadata about the project like kind of modules and versions used, Author of the application, license, keywords, repository.

To create package.json file and node_modules folder (for respective libraries)

Use

npm init

It will help us create a package.json file with metadata about the project, and when code is to be transmitted, we can remove the node_modules folder created and when the project is to be run again.

We can use npm install to install all dependencies.