【问题标题】:ERESOLVE unable to resolve dependency tree while installing Font AwesomeERESOLVE 在安装 Font Awesome 时无法解析依赖树
【发布时间】:2022-08-21 16:54:00
【问题描述】:

我正在开发一个 react native 项目,我尝试安装 Font Awesome \"npm i --save @fortawesome/react-native-fontawesome @fortawesome/fontawesome-svg-core react-native-svg\" 使用但我得到了

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: homesick@1.0.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@\"^18.2.0\" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@\"18.0.0\" from react-native@0.69.4
npm ERR! node_modules/react-native
npm ERR!   react-native@\"0.69.4\" from the root project
npm ERR!   peer react-native@\">= 0.67\" from @fortawesome/react-native-fontawesome@0.3.0
npm ERR!   node_modules/@fortawesome/react-native-fontawesome
npm ERR!     @fortawesome/react-native-fontawesome@\"*\" from the root project
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 /Users/itaylador/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/itaylador/.npm/_logs/2022-08-15T22_50_28_934Z-debug-0.log

我该如何解决这个错误?

    标签: react-native npm error-handling font-awesome


    【解决方案1】:

    我最近有同样的问题。尝试了很多配置,但唯一对我有用的是在 package.json 中从 react@18.2.0 降级到 react@18.0.0

    stackoverflow 上的其他一些人给出了提示(如果你有对等依赖冲突)打开(在 MacOS 上)/Users/YourUser/.npm 文件夹并删除文件夹 _cacache、_logs、_npx

    您也可以尝试在最后删除 node_modules 文件夹和 package-lock.json 文件,然后通过“npm install”重新安装

    【讨论】:

      猜你喜欢
      • 2022-06-14
      • 2021-08-04
      • 2021-09-25
      • 1970-01-01
      • 2021-03-24
      • 2022-01-25
      • 1970-01-01
      • 1970-01-01
      • 2021-06-23
      相关资源
      最近更新 更多