I'm getting this error all time.
Installing node modules
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular-devkit/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/typescript
npm ERR! dev typescript@"~4.9.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@"~4.8.2" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/typescript
npm ERR! peer typescript@"~4.8.2" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /tmp/npmcache.zQoom/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.zQoom/_logs/2022-11-19T21_40_57_670Z-debug-0.log
-----> Build failed
I tried npm install --save --legacy-peer-deps,updating all libaries etc. but I cannot fix it. Can sb help me with that?
CodePudding user response:
--legacy-peer-deps
is rarely the correct choice. Fixing the conflict is always better.
In this case, you have a direct dependency on TypeScript ~4.9.3
and a peer dependency of ~4.8.2
from @angular-devkit/build-angular
. Those two version constraints are in conflict.
In general, you have two choices: downgrade your direct dependency or upgrade the dependency with the relevant peer dependency.
But in this case, it looks like you're already using the latest version of @angular-devkit/build-angular
. TypeScript 4.9 is only a few days old, so it's not surprising that some of your dependencies aren't compatible with it yet.
I suggest you revise your direct TypeScript dependency to match your peer dependency: ~4.8.2
.