Node Package Manager (NPM) is a command line tool that adds, updates or removes Node packages to your application. It is also an online repository of open source packages for Node.js. The global node community creates useful modules and publishes them as packages in this repository.

It has now become a popular package manager for some open JavaScript frameworks such as AngularJS, jQuery, Gulp, Bower etc. Official Website:

NPM is included with Node installation. After installing Node.js, confirm NPM installation by typing the following command in terminal or in order Prompt.

C:\> npm -v

If you have an older version of NPM then you can update it to the latest version using the below command.

C:\> npm install npm -g

To access NPM help, write npm help in the command immediate or terminal window.

C:\> npm help

NPM does this work in two ways: local and local. In global mode, NPM performs tasks that affect all Node.js applications on a computer and in local mode, NPM performs functions of a specific local directory that only affects the current text system.

Install Package Locally

Use the following command to insert any third-party module into the local Node project folder.

C:\>npm install 

For example, the below command will install ExpressJS into MyNodeProj folder.

C:\MyNodeProj> npm install express

All modules installed using NPM are listed under the node_modules folder. The command above will create an ExpressJS folder below the node_modules folder in the root folder of your project and install Express.js there.

Enter dependence on package.json

Use --save at the end of the input command to add dependence in package.json for your application.

For instance, the below command will install ExpressJS in your application and add dependency in package.json.

C:\MyNodeProj> npm install express --save

The package.json of NodejsConsoleApp project will look something such as following.

  "name": "NodejsConsoleApp",
  "version": "0.0.0",
  "description": "NodejsConsoleApp",
  "main": "app.js",
  "author": {
    "name": "Dev",
    "email": ""
  "dependencies": {
    "express": "^4.13.3"

Install Package Globally

NPM can even install packages worldwide so that the entire node.js application on that computer can import and run installed packages. NPM installs global packages in the //local/lib/ node_modules folder.

Apply -g to the installation order to install the package worldwide. For example, the command below will include ExpressJS worldwide.

C:\MyNodeProj> npm install -g express

Update Package

To renew a localized package for your Node.js project, navigate to the Prompt or terminal command path to the project folder and type the following update command.

C:\MyNodeProj> npm update 

The below command will update the existing ExpressJS module to the latest version.

C:\MyNodeProj> npm update express

Uninstall Packages

Use the below command to remove a local package from your project.

C:\>npm uninstall 

The below command will uninstall ExpressJS from the application.

C:\MyNodeProj> npm uninstall express