/errors/npm/eresolve-unable-to-resolve-dependency-tree
npm ERR! code ERESOLVE: unable to resolve dependency tree
- tool
- npm
- exit code
- 1
- versions
- npm 7+
- os
- any
npm stops with ERESOLVE unable to resolve dependency tree when a package you install declares a peer dependency that the version already in your project does not satisfy. The Found: line shows what you have, Could not resolve dependency: shows what the package needs.
Reproduce the error
react-dom@19.0.0 requires react@^19.0.0 as a peer, so installing it next to react@18.3.1 fails:
npm init -y >/dev/null
npm install --no-audit --no-fund react@18.3.1 react-dom@19.0.0Output · exit 1
npm error code ERESOLVE npm error ERESOLVE unable to resolve dependency tree npm error npm error While resolving: work@1.0.0 npm error Found: react@18.3.1 npm error node_modules/react npm error react@"18.3.1" from the root project npm error npm error Could not resolve dependency: npm error peer react@"^19.0.0" from react-dom@19.0.0 npm error node_modules/react-dom npm error react-dom@"19.0.0" from the root project npm error npm error Fix the upstream dependency conflict, or retry this command with --force or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution. npm error npm error npm error For a full report see: npm error /tmp/work/.npm-cache/_logs/2026-10-20T12_24_28_569Z-eresolve-report.txt npm error A complete log of this run can be found in: /tmp/work/.npm-cache/_logs/2026-10-20T12_24_28_569Z-debug-0.log
Read the report
Found: react@18.3.1: the version in your tree.peer react@"^19.0.0" from react-dom@19.0.0: the range the other package requires.- The fix is to make these two agree.
Fix: align the versions
npm init -y >/dev/null
npm install --no-audit --no-fund --silent react@19.0.0 react-dom@19.0.0
npm ls react react-domOutput
work@1.0.0 /tmp/work ├─┬ react-dom@19.0.0 │ └── react@19.0.0 deduped └── react@19.0.0
Alternatively keep React 18 and install a react-dom from the 18 line. npm view react-dom@18 peerDependencies shows which peer range each version expects.
FAQ
Is --force the same as --legacy-peer-deps?
No. --legacy-peer-deps ignores peer dependencies the way npm 6 did. --force accepts conflicting versions and can install a broken tree. Prefer fixing the versions; if you must, --legacy-peer-deps is the narrower workaround.