Reputation: 89
I'm trying to publish my first React Native app in App store and when I'll build in Xcode:
Product > Archive
appears some error, but i already have main.jsbundle
main.jsbundle does not exist. This must be a bug with
- echo 'React Native
Screen Error:
Upvotes: 8
Views: 13779
Reputation: 206
Refresh main.jsbundle with these command
Android build code refresh:=> npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
rm -rf ./android/app/src/main/res/drawable-* rm -rf ./android/app/src/main/res/raw
iOS code Refresh : => npx react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
Upvotes: 0
Reputation: 11
Nict thank you - it helped me! After switching from Intel to m1, the compilation of the application for the Release build failed, namely the error "main.jsbundle does not exist. this must be a bug with". This helped me:
export PATH=/opt/homebrew/bin:$PATH
cd $PROJECT_DIR/..
export NODE_BINARY=node
./node_modules/react-native/scripts/react-native-xcode.sh
Upvotes: 0
Reputation: 3098
For me it was a path-related issue (React Native v0.61).
To solve this issue on Apple Silicon Mac (M2), under build phase for Bundle React Native code and images
:
export PATH=/opt/homebrew/bin:$PATH
export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh
Upvotes: 1
Reputation: 1
Try this instead
Upvotes: 0
Reputation: 1849
In my case, I was able to fix the issue by removing main.jsbundle from Bundle Resources.
Upvotes: 4
Reputation: 2238
I was getting the error because of a bug in the code, instead of using simulator I was using Xcode to install a release build to my device which led to this error.
To fix this, run the app on the simulator make sure it builds and runs properly and then install it on your device.
Upvotes: 0
Reputation: 919
You can generate a new main.jsbundle
using this command.
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
Run this command in your project directory.
Upvotes: 6
Reputation:
watchman watch-del-all
rm -rf node_modules and run yarn install
yarn start --reset-cache
rm -rf /tmp/metro-*
Upvotes: 2
Reputation: 4285
In Xcode, you should be able to find the main.jsbundle
inside the Xcode project sidebar.
If it isn't there, then you should drag the main.jsbundle
into your Xcode project (in the default template app you can find it at ios/main.jsbundle
)
If it is in there, but red - then you need to build a copy of the main.jsbundle
which you can do via react-native bundle
(and some additional args which you can look up.
Upvotes: 0