react-native: 0.19 - Unable to run in simulator using main.jsbundle - Unable to execute JS call: __fbBatchedBridge is undefined
I’ve recently upgraded to 0.19 and my app runs fine if I am getting the javascript from the react packager using this line in AppDelegate.m:
jsCodeLocation = [NSURL URLWithString:@"http://192.168.1.10:8081/index.ios.bundle?platform=ios&dev=true"];
(note that I have to use my IP address here and have that IP added as an App Transport Security Setting exception, I guess because I use google auth in my app).
But to let others run my app through Xcode, while we are developing the backend, I was creating the main.jsbundle using this command:
curl http://localhost:8081/index.ios.bundle -o main.jsbundle
And this worked fine with 0.18.1, but after upgrading to 0.19, if I run the the simulator or even on the device whith this line in AppDelegate.m:
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
I get the error:
Unable to execute JS call: __fbBatchedBride is undefined
I do get this message repeated in the Xcode console.
I’ve read all stackoverflows and issues that match __fbBatchedBridge is undefined and haven’t come up with an answer. I guess dropping back to 0.18.1 and that didn’t solve the problem (see comments below).
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (7 by maintainers)
Commits related to this issue
- Create offline package if not running in "Debug" config Summary:**Problem**: As seen in https://github.com/facebook/react-native/issues/5820, many devs are confused by the fact that the offline bundl... — committed to facebook/react-native by geof90 8 years ago
- Create offline package if not running in "Debug" config Summary:**Problem**: As seen in https://github.com/facebook/react-native/issues/5820, many devs are confused by the fact that the offline bundl... — committed to pglotov/react-native by geof90 8 years ago
- Create offline package if not running in "Debug" config Summary:**Problem**: As seen in https://github.com/facebook/react-native/issues/5820, many devs are confused by the fact that the offline bundl... — committed to facebook/metro by geof90 8 years ago
- Create offline package if not running in "Debug" config Summary:**Problem**: As seen in https://github.com/facebook/react-native/issues/5820, many devs are confused by the fact that the offline bundl... — committed to react-native-community/cli by geof90 8 years ago
I ran into a similar issue with the
__fbBatchedBridgeerror for different reasons (I accidentally deleted the reference to main.jsbundle from my Xcode project). I believe the error arises when React can’t find the main.jsbundle file in your app’s main bundle at runtime.I was able to resolve it as follows:
react-nativecommand line to regenerate the main.jsbundle file (note that this command must be run from the root of your react native project).$ react-native bundle --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundleMoreover this is NOT documented on the docs for running in offline mode. I literally spent one day trying to arrive at this issue.
I don’t think this issue is resolved even with react-native version 23 and 25. How is this marked closed? I cannot still run emulator with offline bundle and keep getting fbBatchedBridge undefined error. Can someone re-open this and investigate please?
For those like me who may spend a day figuring out why they have the error “Unable to execute JS call: __fbBatchedBridge is undefined” after they upgrade to OS x El Capitan 10.11 with react-native 0.29 When upgrading, the owner of usr/local changes and then the watchman can’t run so you have to exec a chown on that folder so that it belongs to you. Once done, you will be able, in the folder of your project, to start again npm and finally to build your app without this error 😉