17

I've noticed that file main.jsbundle file is missing from the project and am not sure of how to fix it, should I delete the file / is there a step I can perform to fix it?

Here is a screenshot of where it is in the project:

enter image description here

Update:

Similar issue appears with following frameworks as well

enter image description here

7
  • try the following command in the root of your project $ react-native bundle --minify to re-generate the offline bundle Commented Jan 3, 2017 at 9:50
  • @pritishvaidya this error output occurs error: unknown option --minify'` using react-native-cli v2.0.1 with react-native v0.39.2
    – Ilja
    Commented Jan 3, 2017 at 9:59
  • i think they removed the minify option in some of the latest version,you can try this command $ react-native bundle --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundle from the root of your project Commented Jan 3, 2017 at 10:07
  • @pritishvaidya this seems to have worked, with one error outputted Assets destination folder is not set, skipping... any ideas? Also, would you like to submit a more detailed answer for this so I can reward a bounty?
    – Ilja
    Commented Jan 3, 2017 at 10:33
  • for this error i want to know the version of your react-native Commented Jan 3, 2017 at 13:32

4 Answers 4

41
+50

The problem can be resolved as follows

  • By using the react native command line
  • $ react-native bundle --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundle using this in the root of the react native project
  • When the main.jsbundle file is generated add it back to the Add Files to Project option
  • Just verify that the file is included in the build phase and re-build

Update For the asset destination to be set they have to be in same folder.

Try this,it would create the asset folder

$ react-native bundle --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundle --assets-dest ./ios
7

If you're ejecting from create-react-native-app on react-native v0.50+ the index.ios.js and index.android.js files are now combined into index.js

Before or after ejecting run

npm i -g react-native-cli if you npm install

or

yarn global add react-native-cli if you yarn install

...After Ejecting...

[bad advice]run react-native bundle --entry-file ./index.js --platform ios --bundle-output ios/main.jsbundle . <-- Do Not do this.

[UPDATE] The main.jsbundle is created when xcode opens the terminal bundler. make sure you don't close the terminal window and it will run fine.

5
  • 1
    Don't think this is the issue, I never created app with create-react-native-app it was done via cli normally. Node modules have been deleted alongside package-lock file, even reset npm cache and re-installed them, so don't think issue is there either :/
    – Ilja
    Commented Feb 8, 2018 at 6:02
  • Yeah, this question already had a correct answer, I stumbled upon it and just left this answer for people using CRNA because I had the same issue for a little bit.
    – myself
    Commented Feb 8, 2018 at 14:53
  • Even further update. You do not need your main.jsbundle file. All you need is to make sure that xcode runs the jspackager in a terminal window. Do not close that window and it will serve the main.jsBundle during archiving. It's that same window that opens up when running simulator.
    – myself
    Commented Feb 20, 2018 at 20:19
  • @myself I'm bundling for bugsnag inside of a separate folder to keep it clean with the map & meta. Is there a way to change to reference that bundle instead of the default do you know?
    – MattyK14
    Commented Mar 9, 2018 at 18:37
  • @myself if previously i tried to BAD advice -i dont remember from where but i remember i did that, how can i correct that mistake, thanks Commented Jun 26, 2019 at 16:19
6

i am using react-native version- 0.47.1 in my case after running the command suggested by @pritishvaidya solved the main.js bundle issue, but even in release build i could see the yellow warning boxes. So i modified the command by adding --dev false. That did the trick. Leaving this updated command here in case, someone is stuck like me.

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

I'm on a mac. I'm new to react native, I had the same issue. After 2 hours of trying everything suggested, I solved it. I realised that you need to first start it on a different tab inside the terminal and then run the command "react-native run-ios". So if you still have problems, open terminal, have 2 tabs open. 1) First cd to your project and enter "npm run start". 2) Then go the second tab and enter "react-native run-ios". That should do it.

If you have problems with "react-native run-android" then you should have its simulator open beforehand. Open a third tab and go to ~/Library/Android/sdk/tools, then enter "./emulator -list-avds" to see your installed android simulators, then start one with "./emulator -avd {your-emulator-name}". When you are done, hit "react-native run-android".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.