繁体   English   中英

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

[英]Problem installing material package for Angular

安装角度材料包时出现错误。 我不明白这个错误。 有人可以帮忙吗?

我得到的输出如下所示:

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

此错误是由于冲突的对等依赖项造成的。 您可以尝试使用--legacy-peer-deps运行npm install命令,或者以其他方式修复您正在安装的版本。

在您的情况下,似乎@angular/animations@15.0.3需要安装@angular/core@15.0.3但您实际上是在安装@angular/core@15.0.1

我通过运行命令修复了它:npm install --save conflicting-peer @15.0.1。 对于每一个有冲突的同伴。 谢谢你帮助我。

暂无
暂无

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

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