Sabish.M
Sabish.M

Reputation: 2060

React Native Version Mismatch 0.60.4

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

Upvotes: 2

Views: 1164

Answers (4)

Jonathan Sanchez
Jonathan Sanchez

Reputation: 9444

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",

Upvotes: 1

Sabish.M
Sabish.M

Reputation: 2060

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.

Upvotes: 0

Eftal Yurtseven
Eftal Yurtseven

Reputation: 86

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!

Upvotes: 2

hong developer
hong developer

Reputation: 13926

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

Upvotes: 0

Related Questions