9

I keep getting this errror when i'm trying to run React native app from Xcode 13.3 .

if i run it from terminal ( react-native run-ios ) it works fine.

Please find enclosed error details.

>     > File /Users/Library/Developer/Xcode/DerivedData/appName-crvjvqqnpdxpwkfkxccvnxunhhkw/
Build/Products/Release-iphonesimulator/appName.app/main.jsbundle
> does not exist. This must be a bug with'
My Environment details

MAC OS - 12.3.1 (M1 chip)
Xcode - 13.3
command line tools - 13.3
RN version - 0.61.5

solutions i have tried upto now

npx react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios

(Xcode) -Build Phases -> Bundle React Native code and images , change to

cd $PROJECT_DIR/..
export NODE_BINARY=node
./node_modules/react-native/scripts/react-native-xcode.sh

Please let me know how i can fix this error.

Kartiikeya
  • 2,358
  • 7
  • 33
  • 68

4 Answers4

10

Run

sudo xcode-select --reset

Then run

npx react-native bundle --entry-file ./index.js --platform ios --bundle-output ios/main.jsbundle

main.jsbundle should appear in your ios folder.

Then add this file in xcode:

enter image description here

enter image description here

benek
  • 2,088
  • 2
  • 26
  • 38
0

This was resolve in 0.63.3. https://github.com/facebook/react-native/issues/29351

If you still have issue with higher version, pls try to run react-native bundle command manually.

0

I faced this issue when I updated node v18 from v16. Switching back to v16 fixed the error. React-native 0.62.2

Stanislau Buzunko
  • 1,630
  • 1
  • 15
  • 27
0

This issue has gone on for years but the most common fix I find is the below.

Run this command at the project root level:

npx react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios

Then in build phases in xcode > click 'copy bundle resources' > click the '+' symbol > click 'add other...' > select the newly generated main.jsbundle file in projectname/ios > and tick box for copy contents. Now clean build folder then archive again.

If you have Images also you'll need to add the folder for assets into the same location as the above.

Hope that helps :)

kurtis_dev
  • 41
  • 5