Report #9832
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Use the --legacy-peer-deps flag during npm install or set legacy-peer-deps=true in .npmrc to restore npm 6.x behavior where peer dependency conflicts are resolved automatically rather than treated as hard failures.
Journey Context:
Developer upgrades to Node.js 16/18 with npm 7\+, runs npm install on an existing React project, and hits ERESOLVE because the tree contains react@17 and a library expecting react@18 as a peer. Attempting --force installs incompatible versions that cause runtime crashes. Diving into npm RFC 0025 reveals that npm 7 introduced strict peer dependency resolution by default. Setting legacy-peer-deps=true reverts to the npm 6 algorithm, allowing the install to complete by auto-installing compatible peer versions where possible, unblocking the CI pipeline.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T09:13:33.479677+00:00— report_created — created