[go: up one dir, main page]

0% found this document useful (0 votes)
208 views2 pages

NPM - Node Package Manager

NPM is a command line tool used to install, update, and uninstall Node.js packages. It is included with Node.js installations and allows developers to access packages for Node.js and other JavaScript frameworks. NPM can install packages locally for a specific project or globally to make packages available on the system for any Node.js application.

Uploaded by

chandra_sai898
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
208 views2 pages

NPM - Node Package Manager

NPM is a command line tool used to install, update, and uninstall Node.js packages. It is included with Node.js installations and allows developers to access packages for Node.js and other JavaScript frameworks. NPM can install packages locally for a specific project or globally to make packages available on the system for any Node.js application.

Uploaded by

chandra_sai898
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

4/23/23, 1:11 AM NPM - Node Package Manager

 Previous Next 

NPM - Node Package Manager

Node Package Manager (NPM) is a command line tool that installs, updates or uninstalls Node.js packages in your application. It is also an online repository
for open-source Node.js packages. The node community around the world creates useful modules and publishes them as packages in this repository.

Official website: https://www.npmjs.com


It has now become a popular package manager for other
open-source JavaScript frameworks like AngularJS, jQuery,
NPM is included with Node.js installation. After you install Node.js, verify NPM installation by writing
Gulp, Bower etc.
the following command in terminal or command prompt.

C:\> npm -v
2.11.3

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

C:\> npm install npm -g

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

C:\> npm help

NPM performs the operation in two modes: global and local. In the global mode, NPM performs operations which affect all the Node.js applications on the
computer whereas in the local mode, NPM performs operations for the particular local directory which affects an application in that directory only.

Install Package Locally

Use the following command to install any third party module in your local Node.js project folder.

C:\>npm install <package name>

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

C:\MyNodeProj> npm install express

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

Add Dependency into package.json

Use --save at the end of the install command to add dependency entry into package.json of your application.

For example, the following command will install ExpressJS in your application and also adds dependency entry into the package.json.

C:\MyNodeProj> npm install express --save

The package.json of NodejsConsoleApp project will look something like below.

package.json  Copy

{
"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 also install packages globally so that all the node.js application on that computer can import and use the installed packages. NPM installs global
packages into /<User>/local/lib/node_modules folder.

Apply -g in the install command to install package globally. For example, the following command will install ExpressJS globally.

C:\MyNodeProj> npm install -g express

Update Package

To update the package installed locally in your Node.js project, navigate the command prompt or terminal window path to the project folder and write the
following update command.

https://www.tutorialsteacher.com/nodejs/what-is-node-package-manager 1/2
4/23/23, 1:11 AM NPM - Node Package Manager

C:\MyNodeProj> npm update <package name>

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

C:\MyNodeProj> npm update express

Uninstall Packages

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

C:\>npm uninstall <package name>

The following command will uninstall ExpressJS from the application.

C:\MyNodeProj> npm uninstall express

Visit docs.npmjs.com for more information on Node Package Manager.

Want to check how much you know Node.js?

Start Node.js Test

 Previous Next 

 Share  Tweet  Share  Whatsapp

TutorialsTeacher.com Tutorials

TutorialsTeacher.com is optimized for learning web technologies step by step.  ASP.NET Core  JavaScript

Examples might be simplified to improve reading and basic understanding.


 ASP.NET MVC  jQuery
While using this site, you agree to have read and accepted our terms of use

and privacy policy.  IoC  Typescript

 Web API  Node.js

 Contact Us  C#  Angular 2

 Object-Oriented C#  D3.js

 LINQ  Sass

 Python  Https (SSL)

 Go Lang  AngularJS 1

 SQL

 SQL Server

 MongoDB

 PostgreSQL

 Entity Framework

E-mail list

Subscribe to TutorialsTeacher email list and get latest updates, tips & tricks on C#, .Net, JavaScript, jQuery, AngularJS, Node.js to your inbox.

Email address GO

We respect your privacy.

HOME TERMS OF USE PRIVACY POLICY  2023 TutorialsTeacher.com. All Rights Reserved.

https://www.tutorialsteacher.com/nodejs/what-is-node-package-manager 2/2

You might also like