I'm trying to install this package npm install --save react-redux-firebase
for React and I'm getting this error “Could not resolve dependency: npm ERR! peer react@"^16.3.0 || ^17.0.0" from [email protected]”
I use 18.2 version of React
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: [email protected]
npm ERR! Found: [email protected]
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 [email protected]
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
on.
What can i do:
CodePudding user response:
The problem is that this library does not support react 18 or if they support it they didn't add it as a peer deps: see
You have multiple solutions:
- Downgrading to react 17
- Asking library maintainers and help them to upgrade to react 18
- Forcing versions with npm resolutions (Use it at your own risk as the library does not support react 18 inside their peerDeps)