Using npm
As mentioned when discussing how Node does path lookups, modules may be contained within a folder. If you are developing a program as a module for others to use you should bundle that module within its own folder and publish it. The npm package management system is designed to help you do just that.
As we've seen throughout the examples in this book, a package.json
file describes a module, usefully documenting the module's name, version number, dependencies, and so forth. It must exist if you would like to publish your package via npm. In this section we will investigate the key properties of this file, and offer some hints and tips on how to configure and distribute your modules.
Note
Try npm help json
to fetch detailed documentation for all the available package.json
fields, or visit https://npmjs.org/doc/json.html.
A package.json
file must conform to the JSON specification. For example, properties and values must be double-quoted.
Initializing a package file
You can create...