"react": "16.13.1", "react-native": "0.63.0",
Encountered the below main.jsbundle does not exist. This must be a bug with issue when trying to archive after upgrading to react-native 0.63. was wondering if anyone encounters the same issue
"react": "16.13.1", "react-native": "0.63.0",
Encountered the below main.jsbundle does not exist. This must be a bug with issue when trying to archive after upgrading to react-native 0.63. was wondering if anyone encounters the same issue
This worked for me in a project involving babel-plugin-module-resolver:
ios/*.xcworkspace in Xcode.cd $PROJECT_DIR/.. to go up a directory.The whole script should look like this:
cd $PROJECT_DIR/..
export NODE_BINARY=node
./node_modules/react-native/scripts/react-native-xcode.sh
Note that this might break if the source of this is a bug in 0.63.0, so you may need to undo this on a future release.
Props to @typester for bringing this up on facebook/react-native #29351.
Found a solution
main.jsbundlepackage.json, add"scripts": {
"bundle:ios": "react-native bundle --entry-file index.ios.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios",
"postinstall": "yarn run bundle:ios"
...
},
so the main.jsbundle will be generated
For me the error occurred because I had imports like this:
import Component from '..';
Replacing those with relative paths (@components/path/to/component) fixed the issue.
Not sure why resolving these paths is problematic now.
I dug into the node_modules/react-native/node_modules/@react-native-community/cli/build/commands/bundle/buildBundle.js and placed a catch block in the buildBundle function in order to see the component(s) with the problematic import.
I think @changey's solution also works, it only requires adding an additional build step in the CI.
None of the above fixed it for me, but it works with this PR, it'll probably be released soon https://github.com/facebook/react-native/pull/29477
Just in case somebody finds it useful :)
I upgraded from 0.62.5 to 0.63 and encountered the same error.
In my case, I found out the react-native-xcode.sh script executed in the "Bundle React Native code and images" build phase passed the wrong entry file (index.js) to the build command when it should have used index.ios.js. Not sure exactly why this changed in 0.63.
A solution that worked for me was specifying the correct entry file when running the script:
../node_modules/react-native/scripts/react-native-xcode.sh to ENTRY_FILE=index.ios.js ../node_modules/react-native/scripts/react-native-xcode.shSeen similar issue with RN v0.63. Looking at the error logs noticed that the was an issue with Node memory out of range (EG failed to build bundle). I fixed this by adding:
export NODE_OPTIONS=--max_old_space_size=1024
to Bundle React Native code and images phase script
EG:
export NODE_BINARY=node
export NODE_OPTIONS=--max_old_space_size=1024
../node_modules/react-native/scripts/react-native-xcode.sh
if you use M1'series Mac, you can try below.
cd $PROJECT_DIR/..
export NODE_BINARY=/opt/homebrew/bin/node
./node_modules/react-native/scripts/react-native-xcode.sh

As I ran yarn bundle-ios, the following message showed up.
Unable to resolve module
config/dimensionfromsrc/scenes/Home/index.js: config/dimension could not be found within the project.
I've been using react-native-module-resolver。 I configed "@configs" for path alias。 As you can see above the @ is missing。
Corrected it, main.jsbundle was created, finally。
This is a known issue (https://github.com/facebook/react-native/commit/83777cb4fb5dda89c430b7eff9cd1f28d2577831), and is fixed in 0.63.3 https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#v0633
Just update to ^0.63.3 and you'll be good.
For me, I had .babelrc and babel.config.js files in the same project. So RN could not find certain imported libraries. So l modified my .babelrc this way:
{
"extends": "./babel.config.js",
"plugins": [ //bla bla
],
}
this was how the error stopped for me.
This error is specific to the architecture settings of the Xcode project itself. When the wrong arch is set, you'll receive this error because the bundle failed to build.
Here is an updated answer for anyone receiving this error on Xcode 12.5+
Remove Cache, Reinstall Libraries, and Update Pods
Sometimes this error is purely due to cache referencing a different architecture. Use the react-native-clean-project utility to reset all cache related to the project, reinstall packages, and updates pods. This usually clears up the majority of my missing bundle errors.
Verify Xcode Build Settings (Xcode 12.5+ on x86_64)
For Production: you only need to make sure the Architectures settings set to Standard Architectures (default ${ARCHS_STANDARD}). Excluded Architectures should be empty, and if VALID_ARCHS exists, be sure to rename it, then click Archive.
Simulator: You still need to add the VALID_ARCHS variable for the simulator, but set it to the project's workspace, setting the value to x86_64. In order to keep it a single setting for the entire project, make sure VALID_ARCHS isn't already set in Pods project or the App project. If it is, remove the variable, and then set the value on the workspace. Click Run to start your simulation build.
Now when you need to build for production, simply rename VALID_ARCHS to SIM_VALID_ARCHS, and then Archive.
If you have a non-standard Node.js installation, select your project in Xcode, find 'Build Phases' - 'Bundle React Native code and images' and change NODE_BINARY to an absolute path to your node executable. You can find it by invoking 'which node' in the terminal.