我想将NG Zorro库添加到一个angular项目中,但在尝试执行ng add ng-zorro-antd时,它抛出了以下错误:
code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: random-eat@0.0.0
npm ERR! Found: @angular/animations@13.0.2
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"~13.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/animations@"^12.1.0" from ng-zorro-antd@12.0.2
npm ERR! node_modules/ng-zorro-antd
npm ERR! ng-zorro-antd@"12.0.2" from the root project我已经尝试过同时使用--force和--legacy-peer-deps标志。
发布于 2021-11-23 21:37:53
升级前
.json文件。
1.升级依赖
将Angular升级到12.x版本,参考https://update.angular.io/。如果您使用过@angular/cdk,则运行ng update @angular/cdk。
2.升级NG-ZORRO
运行ng update ng-zorro-antd。如果控制台中出现警告消息,请按照提示修改相应的代码。
来源:https://github.com/NG-ZORRO/ng-zorro-antd/issues/6834
备注:请确保您的angular版本与NG-ZORRO的版本匹配
https://stackoverflow.com/questions/70087150
复制相似问题