8

after checkout when i say react-native run-android im getting below error.

Metro Bundler has encountered an internal error, please check your terminal error output for more details

below is package.json in my project.

{
    "name": "NCAPRNRedux",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "react": "16.2.0",
        "react-native": "0.52.2",
        "react-native-vector-icons": "^4.0.0",
        "react-navigation": "^1.0.0-beta.29",
        "react-redux": "^5.0.6",
        "redux": "^3.7.2",
        "redux-thunk": "^2.2.0"
    },
    "devDependencies": {
        "babel-jest": "22.1.0",
        "babel-plugin-transform-decorators-legacy": "^1.3.4",
        "babel-preset-react-native": "^4.0.0",
        "jest": "22.1.4",
        "react-test-renderer": "16.2.0"
    },
    "jest": {
        "preset": "react-native"
    }
}

anyone had this issue and solved it?

SameerShaik
  • 488
  • 2
  • 10
  • 22

7 Answers7

9

Do you have any require image like this:

require("../assets/user.png")

If yes then please check the image path. I’m facing the same issue, so I just corrected the path and the error is gone.

Manish Ahire
  • 1,243
  • 13
  • 11
7

1.I suggest restarting React. Just run the following commands:

# Kill current processes
killall node -9 

# Start React - Native
react-native start 

# Run android
react-native run-android or  react-native run-ios

That should do the trick.

2.If it is not working then check your image path you have used. For example

 <Image 
  source={require("./images/logo.png")} // check your image path you have used
>
civani mahida
  • 314
  • 3
  • 8
  • Hello civani and welcome to SO, remember to share either documentations or explain your answer alongside with the commands. – Panthro Feb 07 '19 at 08:23
4

run these commands

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

and this command too

rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json

then run

npm i && react-native run-android

or run-ios anything that is applicable

1

I have faced this issue and here is how I fixed it.

If you are sure that there is nothing wrong with your code you can try to restart process in port 8081.

Open your terminal and find process id with below command:

sudo lsof -n -i :8081 | grep LISTEN

Then use kill id where id is returned from lsof

After that just run you application

react-native run-android
Edison Biba
  • 4,384
  • 3
  • 17
  • 33
0

Try removing "react-native-vector-icons": "^4.0.0"

This issue might help you with possible solutions

Fatah
  • 2,184
  • 4
  • 18
  • 39
0

I`ve faced the same issue. In my case basically, it is because of some broken/wrong paths in imports statements. The issue gets solved after correcting all the imports paths i.e styles, components, routers, reducers, actions etc., restarting the emulator and running the build again.

0

This may for the metro.config.js file content. I was have this issue and i changed the node version and done others operations, but my problem dosn't solve, so i changed the metro.config file then fixed this error.

metro.config.js content:

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
};