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



PyCharm 2023.1 Adds Support For Remote Jupyter Notebooks

The 2023 train of releases for PyCharm is underway, with the first major release adding support for remote Jupyter notebooks, enhancements to the new UI, and improved type inference for generics.

Julia 1.9 Adds Native Code Caching

Julia 1.9 has been released with improvements including caching for native code, heap snapshot support, and improved sorting.

More News






or email your comment to:

Last Updated ( Friday, 28 October 2016 )