2

After upgrading to react-native:0.60.4 I have been unable to run my app and I am getting a react-native version mismatch error.

package.json

{
  "name": "abcd",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.1",
    "jetifier": "^1.6.3",
    "moment": "^2.24.0",
    "react": "16.8.3",
    "react-native": "^0.60.4",
    "react-native-btr": "^1.1.4",
    "react-native-document-picker": "^2.3.0",
    "react-native-elements": "^1.1.0",
    "react-native-gesture-handler": "^1.3.0",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-modal-overlay": "^1.3.1",
    "react-native-progress": "^3.6.0",
    "react-native-progress-bar": "^0.1.2",
    "react-native-screens": "^1.0.0-alpha.22",
    "react-native-searchable-dropdown": "^1.1.1",
    "react-native-simple-dialogs": "^1.1.0",
    "react-native-table-component": "^1.2.0",
    "react-native-vector-icons": "^6.6.0",
    "react-navigation": "^3.8.1",
    "react-navigation-fluid-transitions": "^0.3.1"
  },
  "devDependencies": {
    "@babel/core": "7.4.3",
    "@babel/runtime": "7.4.3",
    "babel-jest": "24.7.1",
    "jest": "24.7.1",
    "metro-react-native-babel-preset": "0.53.1",
    "react-test-renderer": "16.8.6",
    "reactotron-react-native": "^3.2.2",
    "reactotron-redux": "^3.1.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

Error Image

Sabish.M
  • 2,022
  • 16
  • 34
  • Try to clean and build your project again. – Ali SabziNezhad Aug 01 '19 at 14:42
  • 1
    Possible duplicate of [React Native Version Mismatch](https://stackoverflow.com/questions/47763824/react-native-version-mismatch) – remeus Aug 01 '19 at 14:43
  • @remeus I don't think it is a duplicate as all the answers in the thread you link are garbage and do not work. (I know because I tried them all.) They all focus on downgrading React-Native and not upgrading the JS part. – FMaz008 Dec 19 '20 at 15:16

4 Answers4

2

1- Close all terminal/bash screen

2- Open new bash and go to project folder

cd ~/Documents/projects/myProject

3- Run your project

react-native run-ios //react-native run-android

4- npm start in your path

myProject$ npm start

best!

1

There is no exact solution to this, because all systems and installations and variations versions are endless.

error screenshot here

So in order to best resolve this without pulling your hair out, is to

  1. Update your react-native by using npx react-native upgrade
  2. Just in case also install React Native globally on your system like this npm install -g react-native-cli
  3. Then create a brand new EXPO or React Native project with npx react-native init AwesomeProject
  4. Then within your package.json view the versions of react and react-native from the new project and compare them to your working project

For example this was my working project

        "expo-barcode-scanner": "~8.2.1",
        "expo-linear-gradient": "~8.2.1",
        "expo-status-bar": "^1.0.2",
        "react": "~16.11.0",
        "react-dom": "~16.11.0",
        "react-native": "^0.61.4",

This was my new project Package.json

    "expo-splash-screen": "^0.5.0",
    "expo-status-bar": "^1.0.0",
    "expo-updates": "~0.2.10",
    "react": "~16.11.0",
    "react-dom": "~16.11.0",
    "react-native": "~0.62.2",

Then finally I used the react and react-native version from my new project and it all worked perfectly

here is the final code for my working project

        "expo-barcode-scanner": "~8.2.1",
        "expo-linear-gradient": "~8.2.1",
        "expo-status-bar": "^1.0.2",
        "react": "~16.11.0",
        "react-dom": "~16.11.0",
        "react-native": "~0.62.2",
Jonathan Sanchez
  • 7,316
  • 1
  • 24
  • 20
  • This solution is incorrect. React Native is up to date:>npx react-native upgrade info No version passed. Fetching latest... warn Specified version "0.63.4" is already installed in node_modules and it satisfies "^0.63.4" semver range. No need to upgrade – FMaz008 Dec 19 '20 at 15:19
0

There is a possibility that the request message to you to execute is correct. Execute the message.

watchman watch-del-all && react-native start --reset-cache
hong developer
  • 13,291
  • 4
  • 38
  • 68
0

Finally i fixed by my own way.

  1. Create another empty project
  2. Copy your resources + packages.json to new project
  3. Do npm install in new project

Issue solved.

Sabish.M
  • 2,022
  • 16
  • 34