I want to create a new react-native app using react-native cli, so I used the command npx react-native init newApp according to the documentation at https://reactnative.dev/docs/environment-setup. While executing this I am getting npm error logs as follows:
PS D:\Android development> npx react-native init newApp
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Need to install the following packages:
[email protected]
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: [email protected]
npm ERR! node_modules/react-native
npm ERR! peer react-native@"*" from @react-native-community/[email protected]
npm ERR! node_modules/@react-native-community/cli
npm ERR! @react-native-community/cli@"^7.0.3" from [email protected]
npm ERR! react-native@"0.70.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! react-native@"0.70.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"18.1.0" from [email protected]
npm ERR! node_modules/react-native
npm ERR! react-native@"0.70.3" 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 C:\Users\abhad\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\abhad\AppData\Local\npm-cache\_logs\2022-10-13T07_58_54_900Z-debug-0.log
Can anyone solve this? Please suggest a solution.