yarn, just because it could download the packages from the
npm registery at a faster rate. However, this point is debatable, so let’s not get into that.
A Peek at Major Changes
Some of the major changes which I want to hightlight in this article and am eagerly looking forward to are:
npm will --saveis available by default now. See the demo with your own eyes.
npmwhile offline will no longer insist on retrying network requests. npm will now immediately fall back to cache if possible, or fail.
--cache-maxhave been deprecated, so, existing npm caches will no longer be used.
- A new
--prefer-offlineoption will make npm skip any conditional requests for stale cache data, and only hit the network if something is missing from the cache.
- A new
--prefer-onlineoption that will force npm to revalidate cached data, ignoring any staleness checks, and refreshing the cache with revalidated, fresh data.
- A new
--offlineoption will force npm to use the cache or exit. It will error with an
ENOTCACHEDcode if anything it tries to install isn’t already in the cache.
- A standardised lockfile feature is available by default and will be for cross-package-manager compatibility (
package-lock.json), and a new format and semantics for shrinkwrap.
- Downloads for large packages are streamed in and out of disk. npm is now able to install packages of any size without running out of memory.
- Last, it’s a bit faster. Demo ⬇︎
Hopefully, they update their docs quickly with this new update and more users like me will be able to switch or access much of these key features. For detailed look into npm5’s features have a look at their official blog post in which they have listed every other breaking change coming with the new release.
To start using the latest version of npm, you can in your terminal window or preferable shell: