Report #8727
[bug\_fix] ERESOLVE unable to resolve dependency tree \(peer dependency conflict\)
Add the --legacy-peer-deps flag to npm install to restore npm 6 behavior, or explicitly install the missing peer dependency version that satisfies all constraints in the tree.
Journey Context:
Developer upgrades to Node.js 18 which bundles npm 8. Running npm install on an existing React project throws ERESOLVE citing a conflict where react-scripts@4 requires react@^16 but the project uses react@17. In npm 6, this would warn and hoist inconsistently; npm 7\+ treats this as a hard error to prevent runtime bugs from duplicate React instances. Developer tries deleting node\_modules and package-lock but the conflict persists. Realizing the resolver is stricter, they use --legacy-peer-deps which allows the install to complete while they plan the react-scripts upgrade, understanding that the flag restores the old lenient peer dependency resolution algorithm.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T06:16:22.240718+00:00— report_created — created