"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.shAs 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.
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. 🎉
babel-plugin-module-resolverfor short absolute imports. Looking closer at the build logs, I can see that it fails to generate the jsbundle the first time it hits one of these imports. I haven't found a solution yet. I assume going back to relative imports would work... - Isaac Overacker.babelrcfile in addition to ababel.config.jswhere I had configured thebabel-plugin-module-resolversettings. I removed.babelrcand got further in generating the jsbundle, but ran into a different error related to my monorepo nohoist rules missing a few libs. Why this only fails on 0.63.0 and not 0.62.2 is still eluding me. I've made it a bit further, but now I have errors similar to Sachanski's answer--relative imports. - Isaac Overacker