Angular3 min read2026-03-01
Angular npm install Error: ERESOLVE unable to resolve dependency tree
Fix peer dependency version mismatches when installing Angular packages with npm.
Error Code / Stack Trace
npm ERR! ERESOLVE unable to resolve dependency treeProblem Overview
npm install fails because an external Angular library expects an older major version of @angular/core than what is currently installed.
Why Does This Happen?
- The third-party library has not yet published updates for the latest Angular major version.
- Strict peer dependency enforcement introduced in npm v7+.
Step-by-Step Solution
Step 1: Install with --legacy-peer-deps
Bypass strict peer dependency resolution if the library is known to work.
bash
npm install --legacy-peer-depsStep 2: Update Angular dependencies using ng update
Use Angular CLI's official migration tool to upgrade packages together.
bash
ng update @angular/core @angular/cliCommon Mistakes to Avoid
- •Using --force instead of --legacy-peer-deps, which can introduce corrupted dependency trees.
Prevention & Best Practices
- Check Angular compatibility matrices on npm before installing community UI packages.
Frequently Asked Questions
What does --legacy-peer-deps actually do?
It restores npm v4-v6 behavior, ignoring peer dependencies when installing packages.
Related Developer Solutions & Tools
Recommended Tools
Related Error Fixes