Using package.json

All Node modules must include a package.json file in their root directory. package.json is a simple JSON text file that defines a module, including dependencies. The package.json file can contain a number of different directives to tell the Node Package Manager how to handle the module.

The following is an example of a package.json file with a name, version, description, and dependencies:

{    "name": "my_module",    "version": "0.1.0",    "description": "a simple node.js module",    "dependencies" : {        "express"   :  "latest"    }}

The only required directives in the package.json file are name and version; the rest depend on what you would like to include. Table 3.2 describes the most common ...

Get Node.js, MongoDB, and AngularJS Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.