7

I have been trying to make a simple test app using react native but I am getting this

image

Sometimes the app runs without any error but again after sometime this error pops up so cam someone please help me. Thank You!!

This is my console output:

image

And this is what I am getting in android studio logcat:

12-04 18:19:42.856 4147-4163/com.album E/unknown:ReactNative: Unable to download JS bundle
                                                          com.facebook.react.common.DebugServerException: The development server returned response error code: 500

                                                          URL: http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false

                                                          Body:
                                                          {"type":"InternalError","errors":[],"message":"Metro Bundler has encountered an internal error, please check your terminal error output for more details"}
                                                              at com.facebook.react.devsupport.BundleDownloader.processBundleResult(BundleDownloader.java:225)
                                                              at com.facebook.react.devsupport.BundleDownloader.access$100(BundleDownloader.java:40)
                                                              at com.facebook.react.devsupport.BundleDownloader$1.onResponse(BundleDownloader.java:192)
                                                              at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
                                                              at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
                                                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                              at java.lang.Thread.run(Thread.java:818)
12-04 18:19:42.899 4147-4164/com.album E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb407eec0
12-04 18:19:42.902 4147-4147/com.album E/unknown:ReactNative: Exception in native call
                                                          com.facebook.react.common.DebugServerException: The development server returned response error code: 500

                                                          URL: http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false

                                                          Body:
                                                          {"type":"InternalError","errors":[],"message":"Metro Bundler has encountered an internal error, please check your terminal error output for more details"}
                                                              at com.facebook.react.devsupport.BundleDownloader.processBundleResult(BundleDownloader.java:225)
                                                              at com.facebook.react.devsupport.BundleDownloader.access$100(BundleDownloader.java:40)
                                                              at com.facebook.react.devsupport.BundleDownloader$1.onResponse(BundleDownloader.java:192)
                                                              at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
                                                              at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
                                                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                              at java.lang.Thread.run(Thread.java:818)
2
  • We will need to see what the console output is and also what the output on your command line is. Commented Dec 4, 2017 at 14:35
  • The error says it’s unable to download js bundle. Thus ensure your application has internet permission or you have internet access Commented Dec 7, 2017 at 6:04

12 Answers 12

6

I restarted my laptop and it worked for me.

I am not saying this is the correct solution but it worked for me.

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

Comments

2

Sometimes this error can occur because the application cache needs to be cleaned.

You could try to get into the Android folder in the react-native project directory and run this command:gradlew clean then go back to react-native root folder and try to run android emulator react-native run-android. Also you could try react-native start --reset-cache.

Comments

1

Just try this line of code in your terminal

  1. sudo lsof -i :8081
  2. kill -9

Comments

1

Try this

1.sudo lsof -i :<Your port>
2.Run sudo kill -9 <PID>
3.Run application again

Comments

1

this worked for me run this command at your project's directory folder

expo r -c

Comments

0

Fam, I fixed my issue and like most of them, it's completely my fault. I was refactoring and deleted some files without cleaning up some imports of the deleted files. The only way I found this was to add a console.log in metro (node_modules/metro/src/lib/formatBundlingError.js).

function formatBundlingError(error) { console.log(error); }

Comments

0

i refer here and manage to fix this problem

  1. downgrade babel-preset-react-native to version 1.9.2
  2. run yarn

Comments

0

Be sure you're using http://localhost:8081/debugger-ui/ and not 10.0.2.x.

Comments

0

I got the same error I solved this error by running sudo npm i command inside the project.

Comments

0

You could try to get into the Android folder in the react-native project directory and run this command:gradlew clean then go back to react-native root folder and try to run android emulator react-native run-android. Also you could try react-native start --reset-cache

Comments

0

It's working

Sometimes this error can occur because the application cache needs to be cleaned.

You could try to get into the Android folder in the react-native project directory and run this command: gradlew clean then go back to react-native root folder and try to run android emulator react-native run-android. Also you could try this: react-native start --reset-cache

Comments

-1

React Native 0.59 by default supports version 3 of gradle. If you have upgraded to version 4 or higher you will get this error:

classpath 'com.android.tools.build:gradle:3.3.1'

When you open the project in Android Studio, if it shows a dialog of Auto Update gradle, you need to skip the update.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.