2021-07-05 乐帮网
nodejs npm
使用npm安装依赖时遇到一点儿麻烦,输入命令 npm install 收到以下错误:
D:\Demo\vkt.demo.ant>npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ant-design-pro@4.5.0
npm ERR! Found: react@16.14.0
npm ERR! node_modules/react
npm ERR! react@"^16.14.0" from the root project
npm ERR! peer react@">=16.9.0" from @ant-design/pro-descriptions@1.8.6
npm ERR! node_modules/@ant-design/pro-descriptions
npm ERR! @ant-design/pro-descriptions@"^1.2.0" from the root project
npm ERR! 1 more (antd)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.2" from react-dom@17.0.2
npm ERR! node_modules/react-dom
npm ERR! react-dom@"^17.0.0" from the root project
npm ERR! peer react-dom@">=16.9.0" from antd@4.16.6
npm ERR! node_modules/antd
npm ERR! antd@"^4.15.0" from the root project
npm ERR! 1 more (@ant-design/pro-descriptions)
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\Administrator\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\Administrator\AppData\Local\npm-cache\_logs\2021-07-05T02_31_48_807Z-debug.log
由以上信息可以看到有关于react和ant-design还有ant-design-pro之间的一场冲突。这个也正是我在安装框架ant-design-pro时遇到的。
解决办法:
npm i --legacy-peer-deps
安装一些包,可能会花一点儿时来下载根据网络情况来定。最终效果如下:
再次输入npm install
D:\Demo\vkt.demo.ant>npm install
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
> ant-design-pro@4.5.0 postinstall
> umi g tmp
added 4 packages in 7s
我们成功了,lebang2020.cn
关注我的微信公众号
在公众号里留言交流
投稿邮箱:1052839972@qq.com
庭院深深深几许?杨柳堆烟,帘幕无重数。
玉勒雕鞍游冶处,楼高不见章台路。
雨横风狂三月暮。门掩黄昏,无计留春住。
泪眼问花花不语,乱红飞过秋千去。
如果感觉对您有帮助
欢迎向作者提供捐赠
这将是创作的最大动力