Home > Mobile >  ERESOLVE Error when installing Angular Material
ERESOLVE Error when installing Angular Material

Time:05-15

I'm currently creating a project with Angular 13, the Ionic CLI, and Angular Material. I have no problem adding @angular/material when I don't use Ionic, but using Ionic I get the following error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"~13.2.2" from the root project
npm ERR!   peer @angular/core@"^13.0.0 || ^14.0.0-0" from @angular/[email protected]
npm ERR!   node_modules/@angular/material
npm ERR!     @angular/material@"*" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"13.3.8" from @angular/[email protected]
npm ERR! node_modules/@angular/animations
npm ERR!   peer @angular/animations@"^13.0.0 || ^14.0.0-0" from @angular/[email protected]
npm ERR!   node_modules/@angular/material
npm ERR!     @angular/material@"*" 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 /Users/**********/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     ------------------------------------------------

I assumed this meant that my NPM was corrupted. I have tried uninstalling and reinstalling node.js and that didn't solve it. I have tried clearing my npm cache. The answers I've seen on other stackOverflow questions also mention trying with --legacy-peer-deps, and that hasn't worked for me either.

I'm using npm: '8.10.0', angular CLI: '13.2.6', and ionic: '6.19.1'

It's looking to me like this is quite an esoteric error, as I haven't found any answers for it online.

Thank you in advance!!

CodePudding user response:

It looks from your screenshot you have @angular/animations in the project v13.3.8. The second part is informing you that this has a peer dependency of @angular/core v13.3.8. Latest packages as of now.

From the first section it would appear that you have @angular/core v13.2.7.

I would advise checking your package.json file for if this is the case. Run 'ng update' to find which packages can be updated, and then 'ng update package-1 package-2 etc'. Imagine the packages will be like, @angular/core and @angular/cli.

Link to ng update docs: https://angular.io/cli/update

Apologies if this doesn't work.

  • Related