为了账号安全,请及时绑定邮箱和手机立即绑定

安装 npm 包、react-circular-progressbar 时出现问题

安装 npm 包、react-circular-progressbar 时出现问题

慕运维8079593 2023-10-14 18:24:27
当我将react-circular-progressbar安装到我的react项目中时,它显示错误,为什么?npm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency treenpm ERR! npm ERR! While resolving: nadeems-portfolio@0.1.0npm ERR! Found: react@17.0.1npm ERR! node_modules/reactnpm ERR!   react@"^17.0.1" from the root projectnpm ERR! npm ERR! Could not resolve dependency:npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from react-circular-progressbar@2.0.3npm ERR! node_modules/react-circular-progressbarnpm ERR!   react-circular-progressbar@"*" from the root projectnpm ERR! npm ERR! Fix the upstream dependency conflict, or retrynpm ERR! this command with --force, or --legacy-peer-depsnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.npm ERR! npm ERR! See /home/nadeem/.npm/eresolve-report.txt for a full report.npm ERR! A complete log of this run can be found in:npm ERR!     /home/nadeem/.npm/_logs/2020-12-05T09_58_59_238Z-deb
查看完整描述

1 回答

?
哆啦的时光机

TA贡献1779条经验 获得超6个赞

这是因为其中一个依赖项无法与您当前的依赖项结合起来解决。

以下部分表明 ciruclar-progressbar(版本 2.0.3)需要 React 15 或 16 作为对等依赖项,并且您在依赖项列表中使用较新的版本。

Could not resolve dependency: peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from react-circular-progressbar@2.0.3

有几种解决方案;

  • 降级不符合您要安装的软件包约束的软件包

  • 查找您尝试安装的软件包版本,该版本已更新其对等依赖项以包含 React 17

  • 使用npm install <package-name> --force忽略它(真的不推荐,除非你已经手动验证没有不兼容)

  • 使用 npm install <package-name> --legacy-peer-deps.

前两个选项是根据您给出的错误推断出来的。而最后两个选项是在错误本身中提供的。


查看完整回答
反对 回复 2023-10-14
  • 1 回答
  • 0 关注
  • 81 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信