How to fix npm ERR! code ERESOLVE npm ERR! While resolving: package@version npm ERR! Could not resolve dependency: npm ERR! peer package@"^version" from other-package in npm
npm found incompatible peer ranges in your dependency graph. Choose versions that satisfy all peers or replace the conflicting package.
Quick fix
Fixes npm ERR! code ERESOLVE npm ERR! While resolving: package@version npm ERR! Could not resolve dependency: npm ERR! peer package@"^version" from other-package
npm install react@17 react-dom@17
# or upgrade the plugin
npm install some-plugin@latest- Identify the incompatible peers
- Select compatible versions
- Refresh lockfile and reinstall
- Use overrides as a last resort
npm install react@17 react-dom@17# or upgrade the pluginnpm install some-plugin@latestnpm ERR! code ERESOLVEnpm ERR! While resolving: package@versionnpm ERR! Could not resolve dependency:npm ERR! peer package@"^version" from other-package
What this error means
When multiple packages specify peers that cannot be satisfied simultaneously, npm stops with ERESOLVE. Typical with framework ecosystems (React/Angular/Vue) when plugins lag major versions.
Typical symptoms
- ERESOLVE conflicting peer dependencies during npm install
- Peer tree shows required vs installed versions
- Install succeeds only with --legacy-peer-deps
Common causes
- Plugins pinned to older peer majors
- Lockfile contains versions outside peer ranges after upgrades
- Mixing prerelease and stable versions of core/peer packages
How to fix "npm ERR! code ERESOLVE npm ERR! While resolving: package@version npm ERR! Could not resolve dependency: npm ERR! peer package@"^version" from other-package"
Read the ERESOLVE output to see which package requires what. Note the required range and the installed version.
Upgrade/downgrade the peer owner or the peer target so ranges overlap:
npm install react@17 react-dom@17
# or upgrade the plugin
npm install some-plugin@latestClear stale resolutions and reinstall:
rm -rf node_modules package-lock.json
npm installIf you must force a peer, add an override and retest. Expect possible runtime breakage if the API changed.
Advanced notes
Keep ecosystem packages on the same major to avoid churn. In monorepos, align workspace peer targets centrally and upgrade lagging packages together.
Frequently asked questions
- What does "npm ERR! code ERESOLVE npm ERR! While resolving: package@version npm E" mean?
- When multiple packages specify peers that cannot be satisfied simultaneously, npm stops with ERESOLVE. Typical with framework ecosystems (React/Angular/Vue) when plugins lag major versions.
- How do I fix "npm ERR! code ERESOLVE npm ERR! While resolving: package@version npm E"?
- npm found incompatible peer ranges in your dependency graph. Choose versions that satisfy all peers or replace the conflicting package.
- What causes "npm ERR! code ERESOLVE npm ERR! While resolving: package@version npm E"?
- Plugins pinned to older peer majors Lockfile contains versions outside peer ranges after upgrades Mixing prerelease and stable versions of core/peer packages
- Is the "npm ERR! code ERESOLVE npm ERR! While resolving: package@version npm E" 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 dependency tree(Stack Overflow)
- ๐npm/cli#4707 ERESOLVE conflicts(GitHub)