我正在尝试为React安装此包npm install --save react-redux-firebase
,但我收到了此错误“Could not resolve dependency: npm ERR! peer react@"^16.3.0 || ^17.0.0" from react-side-effect@2.1.1”
我使用的是React 的18.2版本
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: professional-resources@0.1.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@"^16.3.0 || ^17.0.0" from react-redux-firebase@3.11.0
npm ERR! node_modules/react-redux-firebase
npm ERR! react-redux-firebase@"*" 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 resoluti
上。
我能做什么:
问题是这个库不支持react 18,或者如果他们支持它,他们没有将其添加为对等deps:请参阅
您有多种解决方案:
- 降级以作出反应17
- 询问图书馆维护人员并帮助他们升级以做出反应18
- 强制使用npm分辨率的版本(使用该版本的风险自负,因为库不支持在其peerDeps中使用react 18(
请尝试以下操作:
npm install --legacy-peer-deps react-redux-firebase redux-firestore