Presenting v7.0.0 of the npm CLI

Inca nu este release-ul final.

npm 7.0.0. will not be marked as latest; your workflows will not get npm v7.0.0 by default unless you opt in by running npm install -g npm@7 or install Node.js 15.

Ca si noutati

  • Workspaces: a set of features to the npm CLI that provide support to managing multiple packages from within a singular top-level, root package
  • Automatically installing peer dependencies: prior to npm 7 developers needed to manage and install their own peer dependencies. The new peer dependency algorithm ensures that a validly matching peer dependency is found at or above the peer-dependent’s location in the node_modules tree.
  • package-lock v2 and support for yarn.lock: Our new package-lock format will unlock the ability to do deterministically reproducible builds and includes everything npm will need to fully build the package tree. Prior to npm 7 yarn.lock files were ignored, the npm cli can now use yarn.lock as source of package metadata and resolution guidance.

Si evident ca avem si breaking changes

  • Automatically installing peer dependencies (while this feature is something we think is desirable new behavior, it does potentially break certain workflows).
  • npm uses the package.exports field making it no longer possible to require() npm’s internal modules.
  • npx has been completely rewritten to use the npm exec command. There are various changes in functionality, most noticeable being a prompt if the module you are trying to run is not yet installed.
  • The output of npm audit has significantly changed both in the human-readable and --json output styles.

To learn more about the breaking changes in npm 7.0.0 please check out our in-depth post on the blog.