-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS main.jsbundle will not create automatically or update without manual react-native bundle #18472
Comments
We still have to manually create our bundle for iOS, Android bundle is working fine. |
We had the same issue, the file was checked into the iOS project. We had to remove it & add a new build step
|
Experiencing the same issue (RN version Edit: I think that this can fail for various reasons BUT it should definitely display the content of the errors on the screen, otherwise we are just lost when this happens... (and people get confused, add completely different resolution steps on bug reports, etc...) |
@m-vdb I couldn't realize your workaround. in fact my problem is when I run app on simulator with command |
@jsina you must have another problem that prevents the automatic bundling. Try to debug the execution of |
我只想知道为什么明明需要main.jsbundle文件,框架却不自动生成。。。。。 |
It is my opinion that this should not be such a widespread issue, and there should be solid documentation to resolving this. I will report back when I have resolved our issue, but currently our CI/CD builds are manually running the bundle script. I've read a bit about some having the wrong path to react-native-xcode.sh, but this has never been the case with our project. |
Update - our CI/CD process is now reverting to an old version of the main.jsbundle on android and requires a separate command to create the bundle. We are using |
My problem is I've install node with fishshell
then run |
We have the same issue building an android app - building 4 or 5 build types with It appears the bundler is working correctly, as in the generated Build issues like this have now consumed ~100 hours of my life since starting work with RN at the start of the year so I'm dying for a way that will guarantee a 100% fresh build of our dev/int/beta/release builds and for it to be reproducible! If I repeat the build enough times it (usually) eventually works but the fact that it can give completely different output without any code being changed is worrying. Since 0.56 at least running in dev mode locally seems to have mostly been fixed (just the async storage issue once every 20 or so refreshes) but building APKs remains a big problem (possibly even slightly worse since 0.56 but that's just a gut feeling, I don't have any concrete data). |
Just had the APK size issue again where the first build succeeded and the other 3 failed. From diffing the contents of two of the APKs it looks like none of the assets (images) were copied to the failed one. So that's probably a separate issue to the out of date bundle issue... |
@m-vdb where do you see the output of Reference:
|
in the terminal when you build. You can even call the command yourself with the right arguments |
Thanks for taking the time to reply. I was building from Xcode and didn't see any of my |
@nickmccally still having the same issue. Using RN 0.57 latest one. I found no main.jsbundle was created so I had to create it manually and after that If any change is made in app.js, it does not reflect in the build unless I create bundle again through the command. |
@amirpervaiz086 me too. |
how to make |
@shinriyo run this command inside project: |
Also make sure it is added in copy bundle resources also change this in AppDelegate.m |
Side note on this issue - I was in the situation where the main.jsbundle wasn't being auto generated on a release build, meaning each time I made a change to my JS I had to re-run the Turns out there is a tick box "Run script only when installing" within Xcode found in 'Build Phases' > 'Bundle React Native code and images' section. I have now unticked this. I must have ticked this to fix some other issue and forgotten about it! But now the main.jsbundle script is getting rebuilt each time I run through Xcode. Win. |
In response to @npalethorpe 's solution: Mine was unticked and a bundle was still not being built automatically when the schema was set to Release. I am on:
|
Hi all. We had almost the same problem. We have spend around 5h. And at some point we realize that xCode use old node version. LOOOL, but excuse me WTF. Do not ask how and why... I just add I am on:
|
change yourself jsbundle file name |
in response to @amirpervaiz086 's solution, be sure to restart xcode |
This worked for me |
@mngyuan - Did you do it in that order? Delete |
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/{PROJECTNAME}/main.jsbundle --assets-dest ios |
react-native-cli: 2.0.1 "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'" Run command : npm run build:ios main.jsbundle file dose not created, created some extra files like report.20210421.091227.2175.0.001.json Any one can help me. |
replace |
**➜ Move git:(dev) ✗ npm run build:ios
info Writing bundle output to:, ./ios/main.jsbundle Images are not loading in release mode. Thanks in advance. |
TRANSLATE INTO ENGLISH I just want to know why the main.jsbundle file is obviously needed, but the framework is not automatically generated |
This was the only way to get it working on AppCenter. Thanks @foxundermoon |
During an upgrade from
Removing this line solved the issue, hopefully this helps someone else save 3 days worth of effort 😓 |
Thanks a lot this worked for me |
Worked for me as well! Thanks |
This worked for me |
I was able to fix the bug by changing the project.pbxproj "Build Phases -> Bundle React Native code and images" to
This way all the js bundle and assets will be added while building the code projects. Works with react-native >= 0.63 |
For my case,
Change the script in "Build Phases -> Bundle React Native code and images" as below work for me.
|
your save my day 🎁 |
|
@shayelbaz1 We had a similar problem when using Node Version Manager (nvm). If your "default" node installation alias isn't set to the version of node you're using for the RN builds, then it will result in error. If the build script from react-native included a step to detect if NVM was being used and then call |
Indeed was caused by |
In my opinion this could have been caught earlier during the Maybe inside the |
run this at the root of the project's terminal: |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
React native is not creating a main.jsbundle for ios automatically. One must manually be created, even though the scheme set as release. The code used to create a bundle manually:
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
Update this exact issue is happening on android now for us as well during our Jenkins build process. We are able to manually bundle using:
react-native bundle --entry-file index.js --platform android --dev false --bundle-output android/main.jsbundle --assets-dest android
No errors occur when this is run, and a bundle is created/updated. From this point forward no bundle updates occur. The following is in Bundle React Native code and images:
export NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh
Environment
Environment:
OS: macOS High Sierra 10.13.3
Node: 8.9.4
Yarn: 1.3.2
npm: 5.7.1
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.2
react-native: 0.54.2 => 0.54.2
Steps to Reproduce
I have been experiencing this with an existing project. I even created a new react native project, and opened the xcode project. It shows main.jsbundle as a missing file. I modified the project scheme to Release, and from there -> Build. No main.jsbundle was created in the iOS project folder. One can manually be created with the code above without an error message.
Expected Behavior
A new main.jsbundle would update on build when the following is run: build from xcode OR
react-native run-ios --configuration Release
Actual Behavior
No main.jsbundle is created/updated
The text was updated successfully, but these errors were encountered: