npm ERR! ERESOLVE Could Not Resolve Dependency
This error matches known, documented patterns with reliable solutions.
Quick Fix (Most Common Solution)
- Use --legacy-peer-deps to bypass strict peer dependency checks (safe for most existing projects)
- Read the error output carefully to identify which two packages conflict
Seeing "npm ERR! ERESOLVE could not resolve"? This error can be frustrating, but it's usually fixable. It typically affects your development workflow or system. Below you'll find clear, step-by-step solutions to resolve this issue.
What This Error Means
npm v7 and later enforce strict peer dependency resolution. A package in your project requires a peer dependency at a version that conflicts with what another package needs. npm cannot find a dependency tree that satisfies both, so it blocks the install.
Frequently documented in developer and vendor support forums.
Not affiliated with browser, OS, or device manufacturers.
New here? Learn why exact error messages matter →
Common Causes
- A package requires a peer dependency version that conflicts with another installed package
- npm v7+ enforces peer dependency rules that npm v6 silently ignored
- Project was originally built with npm v6 and has never been tested against strict peer resolution
How to Fix
- Use --legacy-peer-deps to bypass strict peer dependency checks (safe for most existing projects)
- Read the error output carefully to identify which two packages conflict
- Upgrade the conflicting package to a version that satisfies both requirements
- Use --force only as a last resort — it may install genuinely incompatible versions
Last reviewed: June 2026 How we review solutions
Didn't fix it? Get a personalised solution
Environment-Specific Commands
Quick fix — bypass peer dependency checks
npm install --legacy-peer-deps
Find and resolve the conflict properly
npm install 2>&1 | grep "ERESOLVE" -A 10npm outdatednpm install [conflicting-package]@latest
Quick Diagnostic Path
- If Error mentions a specific package version range → Upgrade that package: npm install [package]@latest — then retry npm install
- If Working in CI but failing locally (or vice versa) → Check npm versions match: npm --version. Different npm versions resolve peer deps differently.
- If --legacy-peer-deps installed but app crashes at runtime → The peer dependency mismatch is real — upgrade the conflicting package to a compatible version
If This Still Fails, Check
- npm overrides (npm 8.3+): add an 'overrides' key in package.json to force a specific version: {"overrides": {"conflicting-package": "1.2.3"}}
- Yarn users: yarn add --ignore-engines. pnpm users: pnpm install --shamefully-hoist as the equivalent flag
- After --legacy-peer-deps: run npm audit to check for any security issues introduced by the relaxed peer resolution
ERESOLVE resolution options
# Option 1: bypass peer dependency checks (quickest fix)
npm install --legacy-peer-deps
# Option 2: see the full conflict tree
npm install --verbose 2>&1 | grep -A 5 "ERESOLVE"
# Option 3: force install (risky — may install incompatible versions)
npm install --force
# Verify the install succeeded
npm list --depth=0OS-Specific Behavior
Npm Eresolve Could Not Resolve Differences Between Windows and Unix Environments
Npm Eresolve Could Not Resolve when deployed on Windows or run in WSL2, because of path separator differences, filesystem behavior, and shell command portability.
The most common portability issue: hard-coded Unix path separators (/) in Node.js code work on macOS and Linux but fail on Windows native paths. Use Node's path.join() and path.resolve() rather than string concatenation — these functions use the correct separator for the current platform. For npm scripts that use shell commands, Windows does not have rm -rf, cp -r, or & for background processes — use the cross-env package for environment variables, rimraf for recursive deletion, and concurrently for parallel scripts. The process.platform property ('win32', 'darwin', 'linux') lets you branch platform-specific code explicitly. When Npm Eresolve Could Not Resolve appears only on one OS, immediately check for hard-coded paths, shell command assumptions, and line ending handling.Optional follow-up
Some users ask whether saving fixes for recurring errors would be useful when the same issue appears again.
Was this explanation helpful?
Frequently Asked Questions
Is --legacy-peer-deps safe?
For most projects, yes. It matches npm v6 behavior — packages install but peer mismatches are not enforced. Test your app after installing to confirm nothing broke at runtime.
When should I NOT use --legacy-peer-deps?
Avoid it for security-critical packages where version compatibility is important. In those cases, resolve the conflict by upgrading the packages properly.
Why did this work before?
npm v6 only warned about peer dependency mismatches; npm v7 and later block the install entirely. If you upgraded npm, that is likely why it broke.
Related Resources
Also Known As
- Node.js error
- Node runtime error
- JavaScript server error
- Node exception
Common Search Variations
- "node js error fix"
- "node command not working"
- "node app crashing"
- "javascript server error solution"
- "node runtime crash fix"
- "how to debug node error"
Related Errors
Still Stuck?
Paste a different error message or upload a screenshot to get help instantly.