banner



How To Use Npm Installed Packages

NPM - Node Bundle Managing director

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.

It has now get a pop bundle director for other open-source JavaScript frameworks like AngularJS, jQuery, Gulp, Bower etc.

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

NPM is included with Node.js installation. After you install Node.js, verify NPM installation by writing the following command in concluding or command prompt.

C:\> npm -5
2.11.3

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

C:\> npm install npm -m

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

C:\> npm assist

NPM performs the functioning in 2 modes: global and local. In the global mode, NPM performs operations which bear on all the Node.js applications on the computer whereas in the local way, 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 political party module in your local Node.js project folder.

C:\>npm install <package name>

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

C:\MyNodeProj> npm install limited

All the modules installed using NPM are installed nether node_modules binder. The above command will create ExpressJS binder nether node_modules folder in the root folder of your projection and install Limited.js there.

Add Dependency into package.json

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

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

C:\MyNodeProj> npm install express --save

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

            {              "name":              "NodejsConsoleApp",              "version":              "0.0.0",              "clarification":              "NodejsConsoleApp",              "principal":              "app.js",              "author": {              "proper name":              "Dev",              "electronic mail":              ""              },              "dependencies": {              "express":              "^iv.13.3"              } }                      

Install Package Globally

NPM can also install packages globally then that all the node.js application on that computer tin import and utilize the installed packages. NPM installs global packages into /<User>/local/lib/node_modules folder.

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

C:\MyNodeProj> npm install -k express

Update Package

To update the bundle installed locally in your Node.js project, navigate the control prompt or concluding window path to the project folder and write the following update control.

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 post-obit command to remove a local parcel from your project.

C:\>npm uninstall <package name>

The following command volition 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?

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

Posted by: williamssuest1997.blogspot.com

0 Response to "How To Use Npm Installed Packages"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel