BT

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

| by Sergio De Simone Follow 14 Followers on Sep 24, 2014. Estimated reading time: 1 minute |

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 Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT