Github first introduced the npm v7 last in May. Today, GitHub has announced the release of npm v7.0.0, which will be shipping with Node.js 15.0.0 next week.
NPM CLI v7.0.0
you can install it today by running npm i -g [email protected]
in your terminal.
Features in New NPM CLI
npm 7 comes with some long-awaited and requested features including:
Workspaces
A set of features that support and 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-dependencies location in the node_modules tree.
package-lock v2 and support for yarn.lock
The 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.
in old version yarn.lock files were ignored, the npm CLI can now use yarn.lock as a source of package metadata and resolution guidance.
Breaking Changes
- Automatically installing peer dependencies (while this feature is desirable new behavior, but it does potentially break certain workflows).
- npm uses the
package.exports
field making it no longer possible torequire()
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 the npm audit has significantly changed both in the human-readable and
--json
output styles.
To learn more about the breaking changes of the new release of npm 7.0.0 check out the in-depth post on the npmjs.com blog.
Links
Release Date: October 13, 2020
NPM CLI Release News: The GitHub Blog
Breaking changes: in-depth post on the npmjs.com blog