BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Node Package Manager

Node Package Manager

This item in japanese

Bookmarks

Since its 1.0 release last month, the Node Package Manager has had a number of point revisions and is being increasingly used to manage Node.js runtimes.

With its deceptively simple one-line install (curl http://npmjs.org/install.sh | sh), provided that Node.js is already installed on the system. This allows you to acquire further Node packages using npm install, much like Python's easy_install or Perl's CPAN.

Node packages are represented as package.json files. The self-documenting npm help json gives the documentation (at https://github.com/isaacs/npm/blob/master/doc/json.md) gives a list of what's required, but includes:

  • name: something descriptive, and will be part of the URL and command line invocations (see the Npm Registry for examples)
  • version: based on semantic versioning, but permits versions to start with a v and to treat anything with a dash as unreleased code (so that git describe can be used to version contents easily)
  • description: short descriptive text, suitable for presenting to a user or searching
  • keywords: for search optimisation
  • homepage: the human-viewable website
  • url: location of package if it's not the same location as the package.json
  • main: the object to be returned at startup
  • files: the files as part of this package
  • repository: the location and type of where to access the sources or to contribute bug fixes
  • config: a set of parameters which can be acquired by your code, as well as overridden in the command with node config set

Node package manager is available on http://github.com/isaacs/npm for those that want to refer to the Readme or to fork the code.

Rate this Article

Adoption
Style

BT