ERROR in ./node_modules/ng-zorro-antd/src/ng-zorro-antd.less (./node_modules/raw-loader!./node_modul

本文介绍了解决Angular 4与Ng-Zorro组件库兼容性问题的方法,包括安装特定版本的Less和Angular CLI,确保项目的正常运行。

使用angular4与ng-zorro是产生的错误经过查阅和尝试解决办法如下:

1.npm install less@2.7.2

安装less@2.7.2版本

我的项目angular\cli 默认安装的是3.0.4资料显示不兼容安装后ng-zorro启动无任何问题(如若第一步成功了第二步即可省略)

2.如若还是报错的话尝试安装Angular CLI 1.7.4版本,也有资料显示ng-zorro不支持6版本然后ng-v查看

npm uninstall -g @angular/cli //卸载angular/cli /

npm cache clean //清除缓存

npm install -g @angular/cli@1.7.4


如图所示则表示成功如果用的是webstrom里面的命令行记得重启!!!

如若对大家有帮助记得点赞关注哦!

PS C:\$dan_file\project\alb\ems\ems_react> npm install npm error code ERESOLVE npm error ERESOLVE could not resolve npm error npm error While resolving: @angular/animations@11.2.14 npm error Found: @angular/core@10.2.5 npm error node_modules/@angular/core npm error peer @angular/core@"10.2.5" from @angular/common@10.2.5 npm error node_modules/@angular/common npm error peer @angular/common@"10.2.5" from @angular/platform-browser@11.2.14 npm error node_modules/@angular/platform-browser npm error peer @angular/platform-browser@"11.2.14" from @angular/forms@11.2.14 npm error node_modules/@angular/forms npm error peer @angular/forms@"^11.0.4" from ng-zorro-antd@11.4.2 npm error node_modules/ng-zorro-antd npm error 3 more (@angular/router, ng-zorro-antd, @ant-design/icons-angular) npm error peer @angular/common@"^10.0.0" from pro-layout@0.0.38 npm error node_modules/pro-layout npm error pro-layout@"0.0.38" from the root project npm error peer @angular/core@"10.2.5" from @angular/platform-browser@11.2.14 npm error node_modules/@angular/platform-browser npm error peer @angular/platform-browser@"11.2.14" from @angular/forms@11.2.14 npm error node_modules/@angular/forms npm error peer @angular/forms@"^11.0.4" from ng-zorro-antd@11.4.2 npm error node_modules/ng-zorro-antd npm error peer ng-zorro-antd@"^11.0.0" from pro-layout@0.0.38 npm error node_modules/pro-layout npm error peer @angular/platform-browser@"11.2.14" from @angular/router@11.2.14 npm error node_modules/@angular/router npm error peer @angular/router@"^11.0.4" from ng-zorro-antd@11.4.2 npm error node_modules/ng-zorro-antd npm error peer ng-zorro-antd@"^11.0.0" from pro-layout@0.0.38 npm error node_modules/pro-layout npm error 2 more (ng-zorro-antd, @ant-design/icons-angular) npm error 1 more (pro-layout) npm error npm error Could not resolve dependency: npm error peer @angular/core@"11.2.14" from @angular/animations@11.2.14 npm error node_modules/@angular/animations npm error peer @angular/animations@"^11.0.4" from ng-zorro-antd@11.4.2 npm error node_modules/ng-zorro-antd npm error peer ng-zorro-antd@"^11.0.0" from pro-layout@0.0.38 npm error node_modules/pro-layout npm error pro-layout@"0.0.38" from the root project npm error npm error Conflicting peer dependency: @angular/core@11.2.14 npm error node_modules/@angular/core npm error peer @angular/core@"11.2.14" from @angular/animations@11.2.14 npm error node_modules/@angular/animations npm error peer @angular/animations@"^11.0.4" from ng-zorro-antd@11.4.2 npm error node_modules/ng-zorro-antd npm error peer ng-zorro-antd@"^11.0.0" from pro-layout@0.0.38 npm error node_modules/pro-layout npm error pro-layout@"0.0.38" from the root project npm error npm error Fix the upstream dependency conflict, or retry npm error this command with --force or --legacy-peer-deps npm error to accept an incorrect (and potentially broken) dependency resolution. npm error npm error npm error For a full report see: npm error C:\Users\danyu\AppData\Local\npm-cache\_logs\2025-08-06T01_40_08_545Z-eresolve-report.txt npm notice npm notice New major version of npm available! 10.8.2 -> 11.5.2 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.5.2 npm notice To update run: npm install -g npm@11.5.2 npm notice npm error A complete log of this run can be found in: C:\Users\danyu\AppData\Local\npm-cache\_logs\2025-08-06T01_40_08_545Z-debug-0.log PS C:\$dan_file\project\alb\ems\ems_react>
08-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值