Report #14537
[bug\_fix] npm ERR\! ERESOLVE could not resolve dependency tree - unable to resolve dependency tree when peer dependencies conflict
Add --legacy-peer-deps to npm install to revert to npm 6 resolution behavior, or manually align the conflicting peer dependency versions in package.json to satisfy the constraint tree.
Journey Context:
Developer upgrades from Node 14/npm 6 to Node 18/npm 8. Attempts to npm install react-router-dom@6 into an existing React 17 project. Suddenly hits ERESOLVE stating react-router-dom requires react@^18.0.0 but project has [email protected]. Developer deletes node\_modules and package-lock.json, retries, same error. Panics thinking dependencies are broken. Discovers npm 7\+ changed peer dependency resolution to be strict and auto-install peers. Initially uses --force which works but feels dangerous. Eventually realizes the proper fix is either upgrading React to 18, downgrading react-router-dom to v5 compatible with React 17, or using --legacy-peer-deps as a temporary bridge while planning the React upgrade.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T21:48:41.308053+00:00— report_created — created