简体   繁体   English

为 Angular 安装材料包时出现问题

[英]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.您可以尝试使用--legacy-peer-deps运行npm install命令,或者以其他方式修复您正在安装的版本。

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 .在您的情况下,似乎@angular/animations@15.0.3需要安装@angular/core@15.0.3但您实际上是在安装@angular/core@15.0.1

I fixed it by running command: npm install --save conflicting-peer @15.0.1.我通过运行命令修复了它:npm install --save conflicting-peer @15.0.1。 for every conflicting peer.对于每一个有冲突的同伴。 Thanks for helping me.谢谢你帮助我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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