Node Package Manager is the key of developing application

Node Package Manager is the key of developing application
Spread the love

Node Package Manager provides Online repositories for node.js packages/modules which are searchable on search.nodejs.org and Command line utility to install Node.js packages, do version management and dependency management of Node.js packages.

Mostly we can do like that

NPM comes bundled with Node.js installable after v0.6.3 version. To verify the same, open console and type the following command and see the result

$ npm –version

So if you are running an old version of NPM then it is quite easy to update it to the latest version. Just use the following command from root

npm install npm -g

Installing Modules using NPM(Node Package Manager)

Install using this command

npm install your module name

We need to install most famous Node.js web framework module called express

npm install express

Here looks package.json

package.json is present in the root directory of any Node application/module and is used to define the properties of a package. Let’s open package.json of express package present in node_modules/express/

{
“name”: “express”,
“description”: “Fast, unopinionated, minimalist web framework”,
“version”: “4.11.2”,
“author”: {

“name”: “JP Web GURU”,
“email”: “info@jpwebguu.com”
},

“contributors”: [{
“name”: “JP”,
“email”: “jpwebguru@gmail.com”
},

{
“name”: “jacks”,
“email”: “jacks@gmail.com”
},

{
“name”: “jp guru”,
“email”: “jpguru@somethingdoug.com”
},

{
“name”: “dinesh”,
“email”: “dinesh@jpwebguru.com”
},

{
“name”: “vikas”,
“email”: “vikas@jpwebguru.com”
},

{
“name”: “demo”,
“email”: “demo@gmail.com”
},

{
“name”: “jpwebguru”,
“email”: “jpwebguru@jpwebguru.com”
} ],

“license”: “MIT”, “repository”: {
“type”: “git”,
“url”: “https://github.com/strongloop/express”
},

“homepage”: “https://expressjs.com/”, “keywords”: [
“express”,
“framework”,
“sinatra”,
“web”,
“rest”,
“restful”,
“router”,
“app”,
“api”
],

“dependencies”: {
“accepts”: “~1.2.3”,
“content-disposition”: “0.5.0”,
“cookie-signature”: “1.0.5”,
“debug”: “~2.1.1”,
“depd”: “~1.0.0”,
“escape-html”: “1.0.1”,
“etag”: “~1.5.1”,
“finalhandler”: “0.3.3”,
“fresh”: “0.2.4”,
“media-typer”: “0.3.0”,
“methods”: “~1.1.1”,
“on-finished”: “~2.2.0”,
“parseurl”: “~1.3.0”,
“path-to-regexp”: “0.1.3”,
“proxy-addr”: “~1.0.6”,
“qs”: “2.3.3”,
“range-parser”: “~1.0.2”,
“send”: “0.11.1”,
“serve-static”: “~1.8.1”,
“type-is”: “~1.5.6”,
“vary”: “~1.0.0”,
“cookie”: “0.1.2”,
“merge-descriptors”: “0.0.2”,
“utils-merge”: “1.0.0”
},

“devDependencies”: {
“after”: “0.8.1”,
“ejs”: “2.1.4”,
“istanbul”: “0.3.5”,
“marked”: “0.3.3”,
“mocha”: “~2.1.0”,
“should”: “~4.6.2”,
“supertest”: “~0.15.0”,
“hjs”: “~0.0.6”,
“body-parser”: “~1.11.0”,
“connect-redis”: “~2.2.0”,
“cookie-parser”: “~1.3.3”,
“express-session”: “~1.10.2”,
“jade”: “~1.9.1”,
“method-override”: “~2.3.1”,
“morgan”: “~1.5.1”,
“multiparty”: “~4.1.1”,
“vhost”: “~3.0.0”
},

“engines”: {
“node”: “>= 0.10.0”
},

“files”: [
“LICENSE”,
“History.md”,
“Readme.md”,
“index.js”,
“lib/”
],

“scripts”: {
“test”: “mocha –require test/support/env
–reporter spec –bail –check-leaks test/ test/acceptance/”,
“test-cov”: “istanbul cover node_modules/mocha/bin/_mocha
— –require test/support/env –reporter dot –check-leaks test/ test/acceptance/”,
“test-tap”: “mocha –require test/support/env
–reporter tap –check-leaks test/ test/acceptance/”,
“test-travis”: “istanbul cover node_modules/mocha/bin/_mocha
–report lcovonly — –require test/support/env
–reporter spec –check-leaks test/ test/acceptance/”
},

“gitHead”: “63ab25579bda70b4927a179b580a9c580b6c7ada”,
“bugs”: {
“url”: “https://github.com/strongloop/express/issues”
},

“_id”: “express@4.11.2”,
“_shasum”: “8df3d5a9ac848585f00a0777601823faecd3b148”,
“_from”: “express@*”,
“_npmVersion”: “1.4.28”,
“_npmUser”: {
“name”: “jpwebguru”,
“email”: “jpwebguru@jpwebguru.com”
},

“maintainers”: [{
“name”: “jacks”,
“email”: “jacks@jpwebguru.com”
},

{
“name”: “jp”,
“email”: “jp@jpwebguru.com”
},

{
“name”: “jpp”,
“email”: “jpp@jpwebguru.com”
},

{
“name”: “jacksp”,
“email”: “jpjacks@exaple.com”
},

{
“name”: “example”,
“email”: “exaple@example.com”
},

{
“name”: “jp”,
“email”: “jp@jpwebguru.com”
},

{
“name”: “jams”,
“email”: “jams@jpwebguru.com”
}],

“dist”: {
“shasum”: “8df3d5a9ac848585f00a0777601823faecd3b148”,
“tarball”: “https://registry.npmjs.org/express/-/express-4.11.2.tgz”
},

“directories”: {},
“_resolved”: “https://registry.npmjs.org/express/-/express-4.11.2.tgz”,
“readme”: “ERROR: No README data found!”
}

Attributes of Package.json

name − name of the package
version − version of the package
description − description of the package
homepage − homepage of the package
author − author of the package
contributors − name of the contributors to the package
dependencies − list of dependencies. NPM automatically installs all the dependencies mentioned here in the node_module folder of the package.
repository − repository type and URL of the package
main − entry point of the package
keywords − keywords

Thanks for reading my blog so keep reading and exploring knowledge

Leave a Reply

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