React-native-code-push: [ios] main.jsbundle is not found

Created on 30 Nov 2016  路  17Comments  路  Source: microsoft/react-native-code-push

When I archive the project and try to run on the real device app just closes with this error message

Nov 28 16:09:09 [3113] : The specified JS bundle file wasn't found within the app's binary. Is "main.jsbundle" the correct file name?
Nov 28 16:09:09 (CoreFoundation)[3113] : * Terminating app due to uncaught exception 'RCTFatalException: The specified JS bundle file wasn't found within the app's binary. Is "main.jsbundle" the correct file name?', reason: 'The specified JS bundle file wasn't found within the app's binary. Is "main...'

I have used react-native link to link code-push and I have checked manually if everything is linked and I didn't find anything wrong.
Also, I have run

code-push release-react MyApp-ios ios
code-push promote MyApp-ios Staging Production

Any ideas?

  • react-native-code-push version: 1.16.0-beta
  • react-native version: "0.35.0"
investigating waiting-for-clarification

Most helpful comment

@iSimar - hi!
Please verify if you able to build main.jsbundle file using following command:
react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle.
If so, could you please provide me with content of AppDelegate.m file?

All 17 comments

Hi @gorangajic, does this error happen the first time the app is run, before the CodePush update is applied, or after an update is applied?

I am seeing the same thing after upgrading react native from 0.25.1 to 0.38.0:

* Terminating app due to uncaught exception 'RCTFatalException: The specified JS bundle file wasn't found within the app's binary. Is "main.jsbundle" the correct file name?', reason: 'The specified JS bundle file wasn't found within the app's binary. Is "main...'

I have figured out my problem, dependencies were installed using npm@2 and after installing npm@3 and reinstalling dependencies again everything was fine.

@joshyg I will close this issue, if you want to stay open I will reopen

That is very strange, so that's good to know. Thanks so much for the update!

Seeing this same problem on first run with Code Push support, release build on development device, there is no update pushed yet.

2017-01-12 14:16:27.942 [fatal][tid:main] The specified JS bundle file wasn't found within the app's binary. Is "main.jsbundle" the correct file name?
2017-01-12 14:16:27.943646 ShimClient[2036:685353] The specified JS bundle file wasn't found within the app's binary. Is "main.jsbundle" the correct file name?
2017-01-12 14:16:27.944034 ShimClient[2036:685353] *** Terminating app due to uncaught exception 'RCTFatalException: The specified JS bundle file wasn't found within the app's binary. Is "main.jsbundle" the correct file name?', reason: 'The specified JS bundle file wasn't found within the app's binary. Is "main...'

Ignore that, the packager failed to build, but didn't stop xcode build 馃槰

The specified JS bundle file wasn't found within the app's binary. Is "main.jsbundle" the correct file name?
libc++abi.dylib: terminating with uncaught exception of type NSException

Getting this error after trying to build for external device. Scheme is set to release.

@iSimar - hi!
Please verify if you able to build main.jsbundle file using following command:
react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle.
If so, could you please provide me with content of AppDelegate.m file?

@sergey-akhalkov I am running into the same problem, perhaps I can shed some light:

#ifdef DEBUG
    jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
#else
    jsCodeLocation = [CodePush bundleURL];
#endif

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"AppName"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];

The CodePushDeploymentKey is definitely in my Info.plist. I have CodePush functioning properly in another project, but I'm still having trouble diffing to figure out what is going wrong.

I have released to Staging twice, and promoted to Production once:

image

The moduleName is the exact same as my AppRegistry's registered component.

@mmoutenot, do I understand that correct that you have [ios] main.jsbundle is not found error?
If so, could you please provide me with the command(s) you are using for releasing CodePush updates for iOS?
Also it would be very helpful if you could provide me with react-native-code-push version, react-native version, repro steps and/or stack trace.

@sergey-akhalkov that is correct. When I try to run a Release build on my physical device (and therefore retrieve the bundle from codepush) that is the error I get.

The command I use to release is code-push release-react HerpAtlasReporter ios
My version of react-native is 0.40.0, of react-native-code-push is 1.17.0-beta.

Steps:

  1. I created a react native app.
  2. I added and linked react native code push
  3. I created a new app for code push, adding the distribution keys to the info.plist, and the code to check for updates in my react app
  4. I change my scheme to Release and run. It fails to run on a physical device with the above error message.

I am sure it's something stupid I've misplaced or mistaken, as I have another app working with codepush...

Thanks for your help.

It may have been a problem with my node version? By changing the Run script build phase:

-                       shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
+                       shellScript = "nvm use\nexport NODE_BINARY=$(which node)\n../node_modules/react-native/packager/react-native-xcode.sh";

The app now properly runs in Release. I think the problem was that the build was succeeding, but built with an incorrect node version it was unsupported? Huh, cool!

@mmoutenot, hmm, seems like you've experienced environment specific problem, you could try to run commands following below and use generated output to determine what version of node causes the issue:

$ nvm ls
...
$ node
> [ process.argv, process.release ]
...

Please let me know if the issue is resolved or if you need any help.

@mmoutenot, just a friendly ping.

@mmoutenot we are closing the issue for now, please reopen or create a new one when you get a chance to look at this.

Neither solution mentioned above worked for me.
For me, this problem is solved by changing file line in: [your_project]/ios/[your_project]/AppDelegate.m:
from
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
to
jsCodeLocation =
[NSURL URLWithString:@"http://127.0.0.1:8081/index.bundle?platform=ios&dev=true"];

I know this thread is old but wanted to add my solution for others.

For me, main.jsbundle was missing from bundle resources.
I fixed this by adding main.jsbundle to MyProject -> Build Phases -> Copy Bundle Resources

Not sure if that file needs to be there or not, but adding it worked for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DeDuckProject picture DeDuckProject  路  3Comments

Fuhrmann picture Fuhrmann  路  3Comments

SudoPlz picture SudoPlz  路  4Comments

Phredward picture Phredward  路  3Comments

osdnk picture osdnk  路  3Comments