mobx
mobx copied to clipboard
Peer dependency issue for [email protected]
Intended outcome:
npm install
successfully with no peer dependency issues when on React 16.8.0
or higher, as stated in docs:
Actual outcome: Getting error message:
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@"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || 16.9.0-alpha.0" from [email protected]
npm ERR! node_modules/mobx-react
npm ERR! mobx-react@"6.3.1" 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/michaeln/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/michaeln/.npm/_logs/2024-02-13T08_50_41_925Z-debug.log
How to reproduce the issue:
Try installing mobx-react
with React
version 17.0.1
.
For some reason I am unable to reproduce this issue in Sandbox / Expo but I am able to on this repo which was created with npx [email protected] init
and adding [email protected]
and [email protected]
.
Versions
Listed in package.json of test repo.
Same here, would love to get a solution to this...
I think this was a documentation error. Mobx-react v6 won't support React v17. You should use mobx-react v7, or React v16. I opened a PR to fix the doc.
From #3832 it superficially seems mobx-react 6 does work correctly with React 17, just the peerDependencies is outdated (e.g. that version is older than React 17 itself). That could be changed by updating the package.json, but since we in principle don't release patches on 3 major version behind packages, I recommend to instead upgrade mobx-react to a newer version.
Closing as documentation has been updated per #3832. Thanks for the investigation @robhybrid!