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

7

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?

Lui answered 5/2, 2018 at 17:24 Comment(4)
Do check the output of the bundler. Did you run npm install?Genteel
Ofcoure if did npm installLui
Try to kill (lsof -i 8081 and kill -9 {PID}) the process already running on the default port (say 8081), restart the emulator (just in case), it may solve the problem.Downandout
I tried this sudo react-native start and it workedBowerman
P
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.

Pantin answered 22/2, 2019 at 10:49 Comment(0)
S
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
>
Sailor answered 7/2, 2019 at 8:16 Comment(1)
Hello civani and welcome to SO, remember to share either documentations or explain your answer alongside with the commands.Vadnais
F
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

Fed answered 8/3, 2018 at 10:14 Comment(0)
C
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
Cromer answered 21/3, 2019 at 10:11 Comment(0)
O
0

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

This issue might help you with possible solutions

Overactive answered 8/3, 2018 at 9:36 Comment(0)
P
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.

Phonemics answered 4/12, 2018 at 6:39 Comment(0)
C
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,
      },
    }),
  },
};
Controversy answered 24/3, 2023 at 2:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.