Reputation: 103
When I attempt to build react native program following its official website guideline on Mac, it gives me the following errors. Any suggestions about debugging?
npx react-native init A2 Need to install the following packages:
react-native@0.69.0 Ok to proceed? (y) y npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: undefined@undefined npm ERR! Found: react-native@0.68.2 npm ERR! node_modules/react-native npm ERR! peer react-native@"*" from @react-native-community/cli@7.0.3 npm ERR!
node_modules/@react-native-community/cli npm ERR!
@react-native-community/cli@"^7.0.3" from react-native@0.68.2 npm ERR! react-native@"0.69.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! react-native@"0.69.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: react@18.0.0 npm ERR! node_modules/react npm ERR! peer react@"18.0.0" from react-native@0.69.0 npm ERR! node_modules/react-native npm ERR!
react-native@"0.69.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. npm ERR! npm ERR! See /Users/student/.npm/eresolve-report.txt for a full report.npm ERR! A complete log of this run can be found in: npm ERR!
/Users/student/.npm/_logs/2022-06-25T16_09_36_906Z-debug-0.log
Upvotes: 3
Views: 940
Reputation: 559
This is a problem with peer dependency on the latest node version. This command should solve the problem: npm config set legacy-peer-deps true
. Take a look on this issue for reference: https://github.com/facebook/react-native/issues/34051#issuecomment-1198463785
Upvotes: 2