简体   繁体   中英

Problem installing material package for Angular

I am getting error while installing angular material package. I don't understand the error. Can someone help with this.

The output I am getting looks like this:

npm install @angular/material @angular/cdk @angular/animations --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: scheduler@0.0.0
npm ERR! Found: @angular/animations@15.0.1
npm ERR! node_modules/@angular/animations
npm ERR!   peerOptional @angular/animations@"15.0.1" from @angular/platform-browser@15.0.1
npm ERR!   node_modules/@angular/platform-browser
npm ERR!     peer @angular/platform-browser@"15.0.1" from @angular/forms@15.0.1
npm ERR!     node_modules/@angular/forms
npm ERR!       @angular/forms@"^15.0.1" from the root project
npm ERR!     peer @angular/platform-browser@"15.0.1" from @angular/platform-browser-dynamic@15.0.1
npm ERR!     node_modules/@angular/platform-browser-dynamic
npm ERR!       @angular/platform-browser-dynamic@"^15.0.1" from the root project
npm ERR!     2 more (@angular/router, the root project)
npm ERR!   @angular/animations@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @angular/animations@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@15.0.3
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@"15.0.3" from @angular/animations@15.0.3
npm ERR!   node_modules/@angular/animations
npm ERR!     @angular/animations@"*" 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 C:\Users\rejki\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\rejki\AppData\Local\npm-cache\_logs\2022-12-14T10_44_35_365Z-debug.log

This error is due to conflicting peer dependencies. you could either try to run the npm install command with the --legacy-peer-deps or otherwise fix the versions you're installing.

In your case it seems that @angular/animations@15.0.3 requires @angular/core@15.0.3 to be installed but you're actually installing @angular/core@15.0.1 .

I fixed it by running command: npm install --save conflicting-peer @15.0.1. for every conflicting peer. Thanks for helping me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM