4

I am trying to run a react native application using the following command.

npm run android

I get the following error.

enter image description here

im using nvm - nvm use stable

Now using node v8.9.4 (npm v4.6.1)

**package.json**

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "react-native-scripts": "1.11.0",
    "jest-expo": "23.0.0",
    "react-test-renderer": "16.0.0"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "expo": "^23.0.4",
    "react": "16.0.0",
    "react-native": "0.50.3"
  }
}

A different solution recommended rerunning the build process because there maybe some interference, but this did not work for me.

2 Answers 2

7

I managed to solve this my self. The error message was showing a react-native version of 0.50.3.

But the latest version is 0.52 as can be seen here https://facebook.github.io/react-native/versions.html.

So i updated package json to reflect this.

  "dependencies": {

    "react-native": "0.52"
  }

then i deleted npm modules and reran npm install. This fixed my issue.

tldr; update package.json react-native dependency to reflect latest version.

Sign up to request clarification or add additional context in comments.

3 Comments

You should probably also upgrade your expo and jest-expo dependencies to version 25, as that is the version of Expo that officially supports React Native 0.52.
Hmm why are the installing older versions? Is it because npm is at v4 to bypass the npm5 compatibility issue?
I don't know what happened there. Maybe you had a newer Expo client installed on your emulator? Or could be a NPM bug, too. Based on your package.json, it should've resolved to Expo 23 with came with React Native 0.50.
1

I Had the same problem, and the KHAN give us the right solution.

I'm Putting here the package.json for thoses who need the fix:

{
  "name": "project",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "react-native-scripts": "1.11.0",
    "jest-expo": "25.0.0",
    "react-test-renderer": "16.0.0"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "expo": "^25.0.0",
    "react": "16.0.0",
    "react-native": "0.52"
  }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.