Satyam Rai
Satyam Rai

Reputation: 401

React Native internal error

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)

Upvotes: 7

Views: 10861

Answers (12)

Thando Zondo
Thando Zondo

Reputation: 51

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

expo r -c

Upvotes: 1

Dino Sunny
Dino Sunny

Reputation: 1051

Try this

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

Upvotes: 1

Sonu Choudhary
Sonu Choudhary

Reputation: 1

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

Upvotes: 0

Rushita
Rushita

Reputation: 1

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

Upvotes: 0

Ko Nyan
Ko Nyan

Reputation: 106

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.

Upvotes: -1

Anil kumar
Anil kumar

Reputation: 1

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

Upvotes: 0

Pedro Soares
Pedro Soares

Reputation: 353

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.

Upvotes: 2

Rajesh Bhartia
Rajesh Bhartia

Reputation: 758

Just try this line of code in your terminal

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

Upvotes: 1

LewisW
LewisW

Reputation: 161

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

Upvotes: 0

unpokkolokko
unpokkolokko

Reputation: 31

i refer here and manage to fix this problem

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

Upvotes: 0

GentryRiggen
GentryRiggen

Reputation: 858

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); }

Upvotes: 0

Satyam Rai
Satyam Rai

Reputation: 401

I restarted my laptop and it worked for me.

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

Upvotes: 5

Related Questions