I tried to archive my react native project using Product > Archive on XCode9.2. But Xcode produce this error:
File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with
My Environment:
OS: macOS Sierra 10.12.6
Node: 9.3.0
npm: 5.5.1
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.0.0 => 16.2.0
react-native: ^0.50.3 => 0.50.4
I also tried to run on terminal
react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/Scavenger/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'
but ended up with error Loading dependency graph...
Unexpected end of JSON input
XCode error.
You need to run the following command:
After that, the app with the static bundle is installed on the real device. But because the nature of the static file, whenever I modify the source code, I need to run that command again to reflect the changes. (You can see next error in command)
Simply cleaning the project in Xcode helped me
This happens when there is no offline bundle file in your project, I had the same problem and this worked for me.
I have added the below line to my package.json file, under
scripts
section, so I don't have to type it every time I want to generate an offline bundle.And then run this command in your application projects folder:
After running the above command, new
main.jsbundle
will be generated in yourios/YourAppName
directory.Next, open your project using XCode, right click on your project name then click Add Files to "
YourProjectName
", choose themain.jsbundle
file that was generated, and then build again.Now it might be working well.
I am using:
Comment this line in AppDelegate.m
Use this line:-
After that run this to make jsbundle:-
Run after this command in xcode . Hope it will make bundle and there is no such error after that ... Thanx
Problem solved after I rewrite shell script. Project > Build Phases > Bundle React Native code and images. There was blank space character in the script.
In my case this was caused by a space character in my project path:
/users/USER/Projects/Project HousePlants/
That space in
Project Houseplants
the bundle can not handle and therefore can not find yourmain.jsbundle
Make sure that you have no whitespace characters in your path and try again.
See this answer