mobx icon indicating copy to clipboard operation
mobx copied to clipboard

Peer dependency issue for [email protected]

Open micnem opened this issue 1 year ago • 4 comments

Intended outcome: npm install successfully with no peer dependency issues when on React 16.8.0 or higher, as stated in docs:

CleanShot 2024-02-13 at 10 52 37@2x

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.

micnem avatar Feb 13 '24 09:02 micnem

Same here, would love to get a solution to this...

yaronlevi avatar Feb 13 '24 12:02 yaronlevi

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.

robhybrid avatar Feb 16 '24 00:02 robhybrid

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.

mweststrate avatar Apr 01 '24 18:04 mweststrate

Closing as documentation has been updated per #3832. Thanks for the investigation @robhybrid!

mweststrate avatar Apr 04 '24 19:04 mweststrate