Basic understanding of package.json in npm

Basics understangind of package.json
  "name": "module-name",
  "version": "1.0.0",
  "description": "An example module to illustrate the usage of a package.json",
  "author": "Your Name <>",
  "contributors": [{
    "name": "Foo Bar",
    "email": ""
  "scripts": {
    "test": "vows --spec --isolate",
    "start": "node index.js",
    "predeploy": "echo im about to deploy",
    "postdeploy": "echo ive deployed",
    "prepublish": "coffee --bare --compile --output lib/foo src/foo/*.coffee"
  "main": "lib/foo.js",
  "repository": {
    "type": "git",
    "url": ""
  "bugs": {
    "url": ""
  "keywords": [
  "dependencies": {
    "primus": "*",
    "async": "~0.8.0",
    "express": "4.2.x",
    "winston": "git://",
    "bigpipe": "bigpipe/pagelet",
    "plates": ""
  "devDependencies": {
    "vows": "^0.7.0",
    "assume": "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0",
    "pre-commit": "*"
  "license": "MIT"
"package.json" file contains complete information of the package. Let's see the Basic details of json object.
  • name: It represents name of the current package
  • version: It represents version number of the current package.
  • description: It contains the information of package like what it can do, how do we use it, etc.
  • author: It takes name of the author and email
  • contributors: It takes list of objects, each object contains the information of  contributor(i.e name and email)
  • scripts: It contains the aliases of commands. Instead of typing long commands we can simply give an alias and use it. If you look at above package.json file you can observe that "scripts" contains the alias command "prepublish" to the long command "coffee --bare --compile --output lib/foo src/foo/*.coffee". Istead of typing the long command we can simply use "npm prepublish"
  • main: It contains the path of the js file. NPM uses it as an initial point.
  • repository:It contains the git url or url of the code control system.
  • bugs: It contains the url where we can raise the issues/bugs of the package.
  • keywords: It contains the search keywords for the package.
  • dependencies: It contains the dependency packages and respective versions used for production.
  • devDependencies:
    It contains the dependency packages and respective versions used for development.