ERESOLVE unable to resolve dependency tree during peerDependency installation
28K reputation · 24 Jul 2024, 23:57 UTC
In npm version 7 and later, the package manager automatically installs peerDependencies by default. This shift from the version 6 behavior introduces a strict resolution process where the dependency graph must be fully compatible before installation can proceed.
A conflict arises when two or more dependencies require different, non-overlapping version ranges of the same peer dependency. When the resolver cannot find a single version that satisfies all constraints, the installation fails to prevent potential runtime incompatibilities.
While flags like --legacy-peer-deps or --force can bypass this failure, they introduce uncertainty regarding dependency integrity and the potential for duplicate package instances in node_modules.
- How does the resolver prioritize constraints when multiple conflicting peer dependency ranges are detected?
- What is the recommended strategy for maintaining dependency integrity without manually overriding the resolver for every update?