【发布时间】:2021-08-02 07:59:56
【问题描述】:
我目前正在做一个 react-native 项目,想安装原生库,但出现以下错误...
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: demo@0.0.1
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"^17.0.1" from the root project
npm ERR! peer react@"*" from native-base@3.0.6
npm ERR! node_modules/native-base
npm ERR! native-base@"3.0.6" from the root project
npm ERR! 1 more (react-dom)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.1" from react-native@0.64.2
npm ERR! node_modules/react-native
PS C:\Users\Bishal Ghosh\Desktop\React-Native\demo> npm install native-base --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: demo@0.0.1
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"^17.0.1" from the root project
npm ERR! peer react@"*" from native-base@3.0.6
npm ERR! node_modules/native-base
npm ERR! native-base@"*" from the root project
npm ERR! 1 more (react-dom)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.1" from react-native@0.64.2
npm ERR! node_modules/react-native
npm ERR! react-native@"^0.64.2" from the root project
npm ERR! peer react-native@"*" from native-base@3.0.6
npm ERR! node_modules/native-base
npm ERR! native-base@"*" 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 C:\Users\Bishal Ghosh\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\Bishal Ghosh\AppData\Local\npm-cache\_logs\2021-08-02T06_48_53_257Z-debug.log
我尝试通过删除我的 node_modules 文件夹来解决这个问题,但没有奏效。然后,我使用 --legacy-peer-deps 安装,它就安装好了。那么,现在我想知道如果我使用这些标志安装我的依赖项,它会长期运行吗??
【问题讨论】:
标签: javascript reactjs react-native npm