How to fix npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! peer dep missing in npm
npm cannot pick a compatible set of dependencies because peer requirements conflict. Align versions (or upgrade both sides) and reinstall.
Quick fix
Fixes npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! peer dep missing
npm install react@17 react-dom@17
# or upgrade plugin to support React 18
npm install some-plugin@latest- Inspect the conflict tree
- Align versions to satisfy peers
- Clean and reinstall
- Use overrides only when you accept the risk
npm install react@17 react-dom@17# or upgrade plugin to support React 18npm install some-plugin@latestnpm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency treenpm ERR! peer dep missing
What this error means
npm v7+ enforces peer dependencies strictly. When two packages demand incompatible peer versions (e.g., plugin wants React 17 while you installed React 18), the resolver aborts with ERESOLVE and shows a conflict tree.
Typical symptoms
- npm install fails with ERESOLVE and a dependency tree showing peer conflict
- Plugins requiring older framework versions block install
- Works only with --legacy-peer-deps or --force
Common causes
- Packages require incompatible peer versions (e.g., React 17 vs React 18)
- Lockfile pins versions outside declared peer ranges
- Mixing majors of a framework and its ecosystem plugins
How to fix "npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! peer dep missing"
npm prints the conflicting packages. Read the requested vs installed versions to identify which pair is incompatible.
Pick compatible versions (upgrade/downgrade both). Example for React:
npm install react@17 react-dom@17
# or upgrade plugin to support React 18
npm install some-plugin@latestAfter adjusting versions, reinstall to refresh the lockfile:
rm -rf node_modules package-lock.json
npm installIf you must force a version, add an override in package.json:
{
"overrides": {
"some-plugin/react": "18.0.0"
}
}Re-run npm install. Test carefully because forced peers may break runtime.
Advanced notes
Avoid --legacy-peer-deps as a long-term fix; it skips peer validation and can hide real incompatibilities. Prefer aligning the ecosystem on the same major version.
Frequently asked questions
- What does "npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency" mean?
- npm v7+ enforces peer dependencies strictly. , plugin wants React 17 while you installed React 18), the resolver aborts with ERESOLVE and shows a conflict tree.
- How do I fix "npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency"?
- npm cannot pick a compatible set of dependencies because peer requirements conflict. Align versions (or upgrade both sides) and reinstall.
- What causes "npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency"?
- Packages require incompatible peer versions (e.g., React 17 vs React 18) Lockfile pins versions outside declared peer ranges Mixing majors of a framework and its ecosystem plugins
- Is the "npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐npm Official Documentation
- ๐npm Docs: peerDependencies(Official Docs)
- ๐npm Docs: legacy-peer-deps(Official Docs)
- ๐ฌStack Overflow: ERESOLVE unable to resolve dependency tree(Stack Overflow)
- ๐npm/cli#4707 ERESOLVE conflicts(GitHub)