Peer dependency issue with react-native-windows
I tried to run npm install on my project and came across this error:
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@"17.0.2" from [email protected] npm ERR! node_modules/react-native-windows npm ERR! peer react-native-windows@"*" from [email protected] npm ERR! node_modules/react-native-fs npm ERR! react-native-fs@"^2.18.0" 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.
react-native info output:
System: OS: Windows 10 10.0.19042 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 3.90 GB / 15.81 GB Binaries: Node: 15.0.1 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 7.0.3 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: API Levels: 28, 29, 30 Build Tools: 28.0.3, 29.0.2, 30.0.2 System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom Android NDK: Not Found Windows SDK: AllowAllTrustedApps: Enabled AllowDevelopmentWithoutDevLicense: Enabled IDEs: Android Studio: Version 4.1.0.0 AI-201.8743.12.41.6858069 Visual Studio: Not Found Languages: Java: 1.8.0_262 npmPackages: @react-native-community/cli: Not Found react: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found
Using version 2.18.0 of react-native-fs
I couldn't find any fix to this issue apart from adding --legacy-peer-deps option to npm install which is not recommended to use. While searching answers to this issue, I found this twitter thread that may help understanding the issue here.
I also encountered this problem, fix would be nice
Still seeing this in a project now, react-native 0.72.1 and react 18.2.0.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
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! peer react@">=16.0" from @react-native-community/[email protected]
npm ERR! node_modules/@react-native-community/clipboard
npm ERR! 21 more (@react-native-community/masked-view, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"18.0.0" from [email protected]
npm ERR! node_modules/react-native-windows
npm ERR! peerOptional react-native-windows@">=0.61" from [email protected]
npm ERR! node_modules/react-native-config
npm ERR! react-native-config@"^1.5.1" from the root project
npm ERR! peerOptional react-native-windows@"*" from [email protected]
npm ERR! node_modules/react-native-fs
npm ERR! react-native-fs@"^2.20.0" from the root project