Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing React Native 0.70.6 on React 18.2

I've started a brand new react native project. When I attempt to install react native, I get dependency resolution errors. Could there be an issue with react 18.2 and react-native 0.70.6? What is the best versions to use? Should I start with react 17?

npm install react-native

I receive the following output:

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@"*" from @react-navigation/[email protected]
npm ERR!   node_modules/@react-navigation/core
npm ERR!     @react-navigation/core@"^6.4.5" from @react-navigation/[email protected]
npm ERR!     node_modules/@react-navigation/native
npm ERR!       @react-navigation/native@"^6.1.1" from the root project
npm ERR!       3 more (@react-navigation/elements, ...)
npm ERR!   12 more (@react-navigation/elements, ...)

From my package.json:

  "dependencies": {
    "@react-navigation/native": "^6.1.1",
    "@react-navigation/native-stack": "^6.9.6",
    "@react-navigation/stack": "^6.3.9",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-native": "^0.70.6",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },

like image 573
Andrew Avatar asked Nov 03 '25 07:11

Andrew


1 Answers

As of [email protected], you should be using React 18.1.0:

npm install "[email protected]"
like image 181
Philip Su Avatar answered Nov 04 '25 20:11

Philip Su



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!