1

I try to install @angular/material-moment-adapter to get a fix on the Date Picker from Angular Material. The project i am working on are using version 10.X.X of the Angular packages (core, compiler, common, etc..). To choose the right version of @angular/material-moment-adapter i looked for the version minor compatibilities, so i saw that the 10.2.7 was compatible with version 10.x.x of the versions of the Angular Packages. So i changed my version for example of Angular/core to ^10.2.5 because @angular/material-moment-adapter@10.2.7 should be compatible with this peerDepedency. But when i try to install : npm i @angular/material-moment-adapter@10.2.7

I still have this error:

Found: @angular/core@10.2.5
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"^10.2.5" from the root project
npm ERR!   peer @angular/core@"^10.0.0 || ^11.0.0-0" from @angular/material-moment-adapter@10.2.7
npm ERR!   node_modules/@angular/material-moment-adapter
npm ERR!     @angular/material-moment-adapter@"10.2.7" from the root project
npm ERR!   3 more (@angular/material, @angular/animations, @angular/cdk)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"10.0.14" from @angular/common@10.0.14
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"~10.0.2" from the root project
npm ERR!   peer @angular/common@"^10.0.0 || ^11.0.0-0" from @angular/material@10.2.7
npm ERR!   node_modules/@angular/material
npm ERR!     @angular/material@"^10.0.1" from the root project
npm ERR!     1 more (@angular/material-moment-adapter)
npm ERR!   1 more (@angular/cdk)
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.

yet, the package compatible asked is

peer @angular/core@"^10.0.0 || ^11.0.0-0" from @angular/material-moment-adapter@10.2.7

And i have @angular/core@"^10.2.5" so it should work, because minor versions asked are from ^10.0.0 || ^11.0.0-0"

Where am i wrong?

Thanks for your lights. Jeremie.

Jeremy
  • 103
  • 9

0 Answers0