picker
picker copied to clipboard
Incompatible with [email protected]
When starting a new react-native project with picker using npm version >= 7, the npm install process fails.
Reproduction steps:
export PROJECTNAME=projectname
npx react-native@latest init $PROJECTNAME
cd $PROJECTNAME
npm install @react-native-picker/picker
Result:
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.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"16 || 17" from @react-native-picker/[email protected]
npm ERR! node_modules/@react-native-picker/picker
npm ERR! @react-native-picker/picker@"*" 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.
...
Workarounds:
- Use --legacy-peer-deps when installing picker
npm install @react-native-picker/picker --legacy-peer-deps - Use an older version of react-native
npx [email protected] init $PROJECTNAME --version 0.68.0 - Use a package manager that doesn't enforce peer dependencies such as yarn or npm prior to 7