Rewritten Search For NPM 4.0
Written by Kay Ewbank   
Friday, 28 October 2016

 The latest version of NPM has been released with some breaking changes, a rewritten search, and deprecated prepublish.

While this is the first major release since npm 3 back in 2015, the developers say that most of the changes are limited to the command line interface. The new version is still officially a trial release.


Writing about the new release on Github, software engineer Kat Marchán described it as the end of an era, explaining that it:

"marks the release when we move both npm@2 and npm@3 into maintenance: We will no longer be updating those release branches with anything except critical bugfixes and security patches."

He also explained that npm is:

"still committed to NPM 2 and NPM 3 working, and NPM 2 remains our LTS (long term support) version, because both of these are going to be used by Node 4 and Node 6 respectively." 

Search is another area that has been worked on. Marchán said on Github that it is still going to be some time before the CLI, registry, and web team are able to overhaul npm search altogether, but until then, they've rewritten the previous implementation to stream results on the fly, from both the search endpoint and a local cache. This won't provide faster results, and this patch does come at the cost of sorting capabilities, but what it does do is start outputting results as it finds them. Marchán said that this should make the experience much better, overall, and the developers believe this is an "acceptable band-aid" until that search endpoint is in place.

Another change to npm 4.0 is the deprecation of the republish lifecycle script. It has been replaced with a prepare script. As Marchán explained on Github:

"If there's anything that really seemed to confuse users, it's that the prepublish script ran when invoking npm install without any arguments.

Turns out many, many people really expected that it would only run on npm publish, even if it actually did what most people expected: prepare the package for publishing on the registry.

And so, we've added a prepare command that runs in the exact same cases where prepublish ran, and we've begun a deprecation cycle for prepublish itself only when run by npm install, which will now include a warning any time you use it that way."

Other changes include the removal of support for partial shrinkwraps. npm-shrinkwrap.json is now considered a complete installation manifest except for devDependencies.


More Information

npm On Github

Related Articles

Yarn The New JavaScript Package Manager  

Package Manager Library Open Sourced

Node.js v6 Released 

Node.js Foundation Releases First Joint Code 

Getting Started with Node.js   


To be informed about new articles on I Programmer, sign up for our weekly newsletter,subscribe to the RSS feed and follow us on, Twitter, FacebookGoogle+ or Linkedin



Initialize Your Spring Boot Projects From The CLI

For the lovers of the command line, Spring Initializer Go is a tool with which you can initialize your Spring Boot projects without using the mouse. Is that essential?

GitLab Adds Google Cloud Integration

GitLab has released public betas of the integration features with Google Cloud that the company announced in 2023. The integration means GitLab’s DevSecOps workflow integrates with Google Cloud secu [ ... ]

More News


C book



or email your comment to:

Last Updated ( Friday, 28 October 2016 )