安装@angular/material 时无法解析依赖树

时间:2021-01-12 17:01:19

标签: angular npm

我正在尝试安装 @angular/material 模块,但每次运行时我都会收到此错误:

$ npm install --save @angular/material
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: front@0.0.0
npm ERR! Found: @angular/animations@9.1.13
npm ERR! node_modules/@angular/animations
npm ERR!   @angular/animations@"^9.1.11" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/animations@"^11.0.0 || ^12.0.0-0" from @angular/material@11.0.3
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.

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

尝试如上所述:

<块引用>

npm install --legacy-peer-deps

More Details.