Report #61152
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps flag to npm install or --force. Root cause: npm 7\+ uses the Arborist engine which strictly enforces peerDependencies, whereas npm 6 ignored them. When transitive dependencies request conflicting peer versions, the resolver cannot find a single valid tree without deduplication breaks.
Journey Context:
Upgraded from Node 14 to 18, bringing npm 8. Running npm install on a legacy React 17 project throws ERESOLVE. The error tree shows [email protected] required by the root, but @storybook/[email protected] peer-depends react@^16.8.0. Digging into npm RFC 25 reveals Arborist changed resolution logic to prevent peer dependency hoisting bugs. Attempting to manually align versions fails because deeper transitive deps \(like eslint-plugin-react\) also conflict. Realizing this is a tooling behavior change, not a package bug, applying --legacy-peer-deps restores the npm 6 lenient behavior, allowing the install to proceed while accepting potential peer version mismatches that the application must handle.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:07:47.240993+00:00— report_created — created