ERESOLVE在安装Font Awesome时无法解析依赖关系树



我正在处理一个react本机项目,并尝试安装Font Awesome"npm i--保存@fortawesome/areact native fontwo敬畏@fortawisome/fontwo敬畏svg核心react nativesvg"使用,但我有

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@18.2.0到react@18.0.0在包中.json

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

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

最新更新