Can't create new project and upgrade to React Native version latest 0.69.1

Viewed 1108

We can not create new project with react native latest version 0.69.1. I created new project with old version. Then I upgrade to 0.69.1. npx react-native upgrade. But I can not upgrade fully. When I run npm i command. The errors comes

npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-test-renderer@17.0.2
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR!   react@"18.0.0" from the root project
npm ERR!   peer react@"18.0.0" from react-native@0.69.1
npm ERR!   node_modules/react-native
npm ERR!     react-native@"0.69.1" from the root project
npm ERR!     peer react-native@"*" from @react-native-community/cli@8.0.2
npm ERR!     node_modules/@react-native-community/cli
npm ERR!       @react-native-community/cli@"^8.0.0" from react-native@0.69.1
npm ERR!     2 more (react-native-call-detection, react-native-get-sms-android)
npm ERR!   1 more (use-sync-external-store)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.2" from react-test-renderer@17.0.2
npm ERR! node_modules/react-test-renderer
npm ERR!   dev react-test-renderer@"17.0.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@17.0.2
npm ERR! node_modules/react
npm ERR!   peer react@"17.0.2" from react-test-renderer@17.0.2
npm ERR!   node_modules/react-test-renderer
npm ERR!     dev react-test-renderer@"17.0.2" 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\Latif\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\Latif\AppData\Local\npm-cache\_logs\2022-07-03T09_00_20_794Z-debug-0.log

How can I upgrade to latest version(0.69.1) of react native?

1 Answers

You have to remove the current react-native library and install the new one.

Following set of commands have worked for me

  1. npm uninstall -g react-native-cli
  2. npm uninstall -g react-native
  3. npm install -g react-native
  4. npm upgrade -g
Related