BT

Your opinion matters! Please fill in the InfoQ Survey!

Npm 5.0 Boosts Common Sense Performance

| by David Iffland Follow 3 Followers on May 30, 2017. Estimated reading time: 2 minutes |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

Npm, Inc. has released version 5.0 of their npm package manager, capping off years of planning, months of coding, and boosting performance to be more in-line with the competition.

In a blog post announcing the release, npm says the new package manager is "a pretty big step forward, significantly improving its performance in almost all common situations". This release is major in not just version number, but in features and breaking changes.

Some of the biggest changes are to the performance and behavior of the cache, which was rewritten. Offline behavior, for example, has been changed; npm will now use the cache if the machine is offline instead of repeatedly trying to access the network. Developers can also set options such as --prefer-offline and --prefer-online to customize how their cache is used.

Because of this major rewrite, all existing caches are invalid and developers will need to re-download packages, so be sure to be on a fast connection when upgrading.

There are also many new features, and one of the most significant is that --save is now the default behavior. When a package is installed, saving a package to the package.json file required developers to issue the command:

npm install  --save

Despite developers almost always intending this behavior, they always had to opt-in explicitly. In 5.0, omitting the flag will save the package to package.json. On the flip side, if the developer doesn't want to save the package, the --no-save flag is now required.

Some in the community have credited yarn, the up-and-coming alternative package manager with lighting a fire under npm and motivating them to improve their performance. Hacker News user chrisweekly wrote, "Thank you, yarn, for helping the community see the naked emperor. Deterministic builds by default are such an obvious (in retrospect) core requirement."

Npm CEO Isaac Schlueter says the changes have been a long time coming and are not a response to yarn:

Everything in npm 5 was literally planned years in advance. When we have this many people depending on a thing, we have to be careful about how we make drastic changes. Yarn was a strong signal from the community that we were on the right track, but it only seems like a "catalyst" when seen from the outside.

Regardless of who thought of it first, developers win with access to better, faster tools. The full release notes are available on GitHub.

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