首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由于依赖项错误,无法将NG Zorro添加到项目中

由于依赖项错误,无法将NG Zorro添加到项目中
EN

Stack Overflow用户
提问于 2021-11-23 20:02:49
回答 1查看 195关注 0票数 0

我想将NG Zorro库添加到一个angular项目中,但在尝试执行ng add ng-zorro-antd时,它抛出了以下错误:

代码语言:javascript
复制
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标志。

EN

回答 1

Stack Overflow用户

发布于 2021-11-23 21:37:53

升级前

  1. 确保Node.js >= 10.13。
  2. 创建一个新分支,或使用其他方法备份当前的产品包-

.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的版本匹配

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70087150

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档