Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

main.jsbundle does not exist. This must be a bug with.. main.jsbundle issue after upgrading to react-native 0.63

"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

enter image description here

like image 392
changey Avatar asked Jul 09 '20 02:07

changey


5 Answers

This worked for me in a project involving babel-plugin-module-resolver:

  1. Open your ios/*.xcworkspace in Xcode.
  2. Click on the name of your project in the project navigator.
  3. Click on the name of your target in the pane on the left.
  4. Click on Build Phases.
  5. Expand the Bundle React Native code and images phase.
  6. On the first line of the script, add 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.

like image 54
Isaac Overacker Avatar answered Oct 17 '22 10:10

Isaac Overacker


Found a solution

  1. In Xcode Build Phases -> Copy Bundle Resources, add main.jsbundle

enter image description here

  1. In package.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

like image 39
changey Avatar answered Oct 17 '22 08:10

changey


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.

like image 3
Sachanski Avatar answered Oct 17 '22 09:10

Sachanski


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 :)

like image 2
Victor Rothberg Gimael Avatar answered Oct 17 '22 08:10

Victor Rothberg Gimael


Change your babel.config.js to .babelrc.js and it will work

like image 1
Sharif Mahmoud Avatar answered Oct 17 '22 08:10

Sharif Mahmoud