BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News NPM Reaches 2.0, Adds Private Node.js Module Management and More

NPM Reaches 2.0, Adds Private Node.js Module Management and More

This item in japanese

Lire ce contenu en français

Bookmarks

Node.js standard package manager, npm, has reached version 2.0. Among npm's new features, scoped packages promise to make it easier to manage private Node.js modules, just as if they were part of the public repository. The new version also marks the introduction of a new release process and offers improved reliability.

Scoped packages are "the most prominent feature driving the release of npm 2," according to npm 2.0 release notes. A scoped package has a name, as any other package, and a scope, which allows to identify it in the following way:

@somescope/somepackagename

Scopes are a way of grouping related packages together so that all packages belonging to the same scope will be installed in the same directory node_modules_base_dir/@myScope, whereas public packages would be installed in node_modules_base_dir. The interesting thing about scopes is that they can be associated to private registries:

npm login --registry=http://reg.example.com --scope=@myco

Once this association is established, it becomes possible to seamlessly use a mix of packages from the public npm registry and one or more private registries.

Besides scoped packages, a lot of work leading to version 2.0 has gone into fixing race conditions, although there is at least one more known race condition waiting to be fixed. This notwithstanding, the work done will make it "much more likely [for npm] to work right, every time."

Finally, npm development team has made official a new release process based on dist-tags. In short, "every week, there are at least two versions of npm published – npm@latest, for everybody, and npm@next, for those who enjoy playing around with new things, or who want to help us test npm."

NPM 2.0 requires node version 0.8 or newer and uses version 4.0 of semver for versioning.

Rate this Article

Adoption
Style

BT