React-native: Unable to execute JS call: __fbBatchedBridge is undefined

Created on 4 Mar 2016  路  33Comments  路  Source: facebook/react-native

Hi guys,

I believe a similar sounding bug has already made it here some time ago (just searching the issue tracker).

The message in the Xcode console is

2016-03-03 22:49:51.428 [warn][tid:main][RCTDevMenu.m:323] RCTSourceCode module scriptURL has not been set
2016-03-03 22:49:51.432 [fatal][tid:com.facebook.React.JavaScript] Unable to execute JS call: __fbBatchedBridge is undefined

Steps to reproduce (using "react-native": "^0.21.0")

  1. Execute react-native init AwesomeProject
  2. open AwesomeProject.xcodeproj in Xcode
  3. edit AppDelegate.m, uncomment jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  4. Product -> Run

I'm just trying to follow the docs from here https://facebook.github.io/react-native/docs/running-on-device-ios.html#using-offline-bundle maybe I'm misunderstanding something.

I also tried generate the main.jsbundle file with react-native bundle --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundle but the same error happens when clicking Run

Thanks for all your work on React native, it's really fantastic!

Locked

Most helpful comment

Same code need to comment in node_modules/react-native/packager/react-native-xcode.sh

if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then echo "Skipping bundling for Simulator platform" exit 0; fi

All 33 comments

Hey,

So, none of the already proposed solutions in the closed issues works for you yet? :(

Leaving the search link for reference: https://github.com/facebook/react-native/issues?utf8=%E2%9C%93&q=__fbBatchedBridge

Hey,

Thanks for getting back so quickly. Yeah, tried a handful yesterday and a few today 鈥撀燽ut it's hard to do a complete enumeration...

However, irrespectively of whether there is a fix in one of those Issues, this is likely close to a step-by-step copy&paste instructions that new users will follow, since this is the vanilla AwesomeProject.

Here is what i tried:

Again, thanks for getting back so fast and providing this support.

Hey,

Can you try commenting out the following lines https://github.com/facebook/react-native/blob/master/packager/react-native-xcode.sh#L15-L18 . It was mentioned here and worked for me

That fixed for me, thanks @shahchirag and @grabbou

in node_modules/react-native/packager/packager.sh

Replace

    if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then     
      echo "Skipping bundling for Simulator platform"       
      exit 0;       
    fi

with

#    if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then        
#      echo "Skipping bundling for Simulator platform"      
#      exit 0;      
#    fi

Out of curiosity, and largely as a digression to this issue, is this a bug? Or is it due to xcode/simulator?

Additionally, i'm guessing not everybody is dependent on the xcode-heavy workflow that i go through, but how else does one upload the Archived version of the code to testflight and alike?

:+1: This solution also worked for me. I just started a new project on React-Native 0.21.0

I know this sort of feels like a hack, but currently that's the only way to fix it. I believe this would be fixed in the coming days.

The hack works, but any updates on this from the React team?

Worked here too RN0.22

Same code need to comment in node_modules/react-native/packager/react-native-xcode.sh

if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then echo "Skipping bundling for Simulator platform" exit 0; fi

The uncomment solution works!
Just wondering is there any side effect for this?
My RN version: 0.26.2

@longsangstan The code is for speeding up build times as stated

# Speed up build times by skipping the creation of the offline package for debug
# builds on the simulator since the packager is supposed to be running anyways.

, so commenting it should just affect build-times, no other side-effects supposedly.

Should this still be occurring for 0.39.2?
I'm getting the same error message, and the fix is working on macOS, building for iOS.

Just ran into this issue today as well, any ideas?

@tonydiepenbrock, same here!

Occurring on 0.40.0

I am getting this issue no 0.41 as well! Commenting out fix doesn't work.. Any ideas?

Getting error on react-native 0.41.2. Commenting https://github.com/facebook/react-native/blob/master/packager/react-native-xcode.sh#L17-L20 fixes it for me.

Occurring on 0.41.0

I was having this problem on 0.42.0 when launching from vscode. I somehow got it fixed by quitting the simulator, and first running react-native run-ios. Now it works when I launch from vscode.

Running react-native-git-upgrade fixed this for me.
(Has to be installed w/ npm install -g react-native-git-upgrade first.)

I have the same problem on 0.42.0, commenting didn't help me, and when I tried "react-native-git-upgrade" , it just says "command not found". Any ideas how to fix it?

@Luckygirlllll did you run npm install -g react-native-git-upgrade first?

@MattyK14 Just have tried it, so I done react-native-git-upgrade, and after that react-native run-ios, and the error didn't disappear.

I'm on the latest version 0.43 and still getting this issue? :(

I was getting this in 0.44, had to import ./app/index instead of ./app for some reason. A more useful error would have been helpful!

0.46 keep constantly getting this error.

Getting the exact same in 0.46.1.

same here, 0.45 with expo sdk 18

same here

Same here. Every time when I do Remote JS Debugging, I get this error on my iOS simulator. If I do not do Debugging, it is fine.

I'm getting it in production on iOS. Any news?

Not getting this error anymore. Maybe because:

  • I started using LAN or localhost hosts of Expo.
  • Expo got updated
  • Started using simulator more often than phone itself for testing
Was this page helpful?
0 / 5 - 0 ratings