0

https://facebook.github.io/react-native/docs/getting-started.html

I have followed the instruction that are on this link. But app is not starting on emulator enter image description here

  1. I then follow the instructions on Delete the node_modules folder - rm -rf node_modules && npm install
  2. Reset packager cache - rm -fr $TMPDIR/react-* or node_modules/react-native/packager/packager.sh --reset-cache
  3. Clear watchman watches - watchman watch-del-all Recreate the project from scratch

and also create whole new project again to but every time this error pops-up

I have

  • npm 4.6.1

  • node v8.11.4

  • jdk version 8
{
  "name": "p3",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.4.1",
    "react-native": "0.56.0"
  },
  "devDependencies": {
    "babel-jest": "23.4.2",
    "babel-preset-react-native": "5",
    "jest": "23.5.0",
    "react-test-renderer": "16.4.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

Any help please.

2
  • React and React-Native versions? Commented Sep 5, 2018 at 9:03
  • @HedeH edited my post with version specified. Commented Sep 5, 2018 at 9:04

3 Answers 3

2

It has been observed that, latest react native version is having a bug in dependencies. I have found it working by modifying the package.json file. Please upadate your package.json file by adding below code:

"dependencies": {
    "react": "^16.4.1",
    "react-native": "^0.55.4"
 },
 "devDependencies": {
    "babel-preset-react-native": "^4.0.0",
 },

and then use below commands:

npm update
npm cache clean --force
cd android
gradlew clean
cd..
react-native run-android
Sign up to request clarification or add additional context in comments.

1 Comment

my react-native version is different so, I will follow your instruction shortly. Currently I am updating my android studio so will not able to run emulator. Will tell you results when completed.
1

Try creating the project using stable versions, do react-native init <Project Name> --version="0.55.2". After this try react-native run-android.

Comments

1

If you want to keep using the react-native 0.56.0 version,

Try this configuration in package.json:

"dependencies": {
  ...
  "babel-runtime": "^6.26.0",
  "react": "^16.4.2",
  "react-native": "^0.56.0",
  ...
},
"devDependencies": {
  ...
  "@babel/core": "^7.0.0-beta.56",
  "babel-eslint": "^8.2.3",
  "babel-jest": "^22.1.0",
  "babel-preset-react-native": "^5.0.0",
  ...
},

If that doesn't work, also try running this script:

Add a script to the scripts section in the package.json file under the root project dir and call it build:android: (The name doesn't matter)

{
  ... 
  "scripts": {
    ...
    "build:android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res",
    ...
  },
  ...
}

Run it from the terminal like this:

npm run build:android

Hope it helps :)

1 Comment

thankyou I will try your solution shortly. Currently Update is running. Will inform you results after following your instructions.

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.