npm 7.0.0, announced on October 13, 2020, automatically installs peer dependencies that developers previously had to manage themselves. Teams upgrading the JavaScript package manager can encounter conflicting package requirements even when their application code has not changed. Repairing those requirements and bypassing the new handling are different migration choices. [S1][S2][S4]
Peer dependencies express requirements for packages used alongside another package. npm's release announcement says the new algorithm finds a matching peer at or above the dependent package's position in the node_modules directory tree. The earlier beta explanation gives the reason for enforcing that relationship: years without automatic peer resolution had allowed projects to overlook conflicts, including ones buried deep in the tree. That is the npm team's rationale, not evidence that every previously working application was broken. [S1][S2]
Not every conflict automatically stops an installation. The configuration documentation shipped with npm 7.0.0 says the default resolver can use the nearest non-peer dependency specification to resolve a conflict, even when the result falls outside a package's declared peer range. It prints a warning when it makes that override. With --strict-peer-deps enabled and --legacy-peer-deps absent, conflicting peer requirements instead become installation failures, including cases npm could otherwise resolve by that guess. The release changelog records improved handling of transitive peer conflicts before the final release. [S3][S4]
The compatibility switch, --legacy-peer-deps, goes further than allowing a warning. It tells npm to ignore peerDependencies while constructing the package tree, following the behavior of npm versions 3 through 6. The released documentation discourages using it because dependent packages may rely on that contract. Nor is --omit=peer an equivalent escape route: omit avoids unpacking peer dependencies on disk, but still designs a tree in which they could be placed correctly. A successful install with the legacy switch therefore does not establish that the conflicting packages are compatible. [S4]
For the person responsible for automated builds, those distinctions suggest a focused migration check. Record the npm version and peer-handling flags used by the build runner, then separate a clean resolution from one that succeeds with a warning or a legacy bypass. npm accepts configuration through command-line flags as well as other sources, so two machines running the same version need not be applying the same policy. Treat a temporary bypass as a dependency-repair task to track, rather than as proof that the upgrade has resolved the conflict. [S4]
Teams had room to stage that work. The October 13 announcement said npm 7.0.0 would not carry the latest tag at launch; users could opt in with npm install -g npm@7. It also said npm 7 would ship with Node.js 15.0.0 the following week—an announced distribution plan, not an already completed rollout. [S1]
Source documents
- Presenting v7.0.0 of the npm CLIhttps://github.blog/news-insights/product-news/presenting-v7-0-0-of-the-npm-cli/
- npm v7 Series - Beta Release! And: SemVer-Major Changes in npm v7https://blog.npmjs.org/post/626173315965468672/npm-v7-series-beta-release-and-semver-major.html
- npm CLI v7.0.0 CHANGELOG.mdhttps://raw.githubusercontent.com/npm/cli/v7.0.0/CHANGELOG.md
- npm CLI v7.0.0 configuration documentationhttps://raw.githubusercontent.com/npm/cli/v7.0.0/docs/content/using-npm/config.md
