Jason Nerer Jason Nerer - 1 year ago 76
iOS Question

Why does mainjs.bundle not build with ReactNative 0.25.1

I had to disable

and install node-6.0.0 via brew in order to get a fresh, non-changed RN app on my iOS device with 9.3.1.

No matter what I do, the
is not re-created. I switch my Schema from
and change AppDelegate.m so the JS is read from the bundle and not the server. But in the moment I compile the app, I receive the following error:

+ DEST=/Users/foobar/Library/Developer/Xcode/DerivedData/TestSome-fpsorufynyrzmuceyzbnallqkbrd/Build/Products/Release-iphonesimulator/TestSome.app
+ node /Users/foobar/tmp/reacttest/TestSome/node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --bundle-output /Users/foobar/Library/Developer/Xcode/DerivedData/TestSome-fpsorufynyrzmuceyzbnallqkbrd/Build/Products/Release-iphonesimulator/TestSome.app/main.jsbundle --assets-dest /Users/foobar/Library/Developer/Xcode/DerivedData/TestSome-fpsorufynyrzmuceyzbnallqkbrd/Build/Products/Release-iphonesimulator/TestSome.app
class CreateSuppressingTerminalAdapter extends TerminalAdapter {
SyntaxError: Unexpected reserved word
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Command /bin/sh failed with exit code 1

To me it seem like, the 6to2 transpilation fails for some reason. If I comment out the class and remove it, where it's used, the next error comes up, complaining about the unknown keyword

If I build mainjs.bundle manually via:

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

I can install the app on my device. But additional resources like images I
are not bundled.

Can anyone tell me, where I can look for the problem?

Answer Source

Try going to node_modules/react-native/packager/react-native-xcode.sh and comment out this line:

if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then     
  echo "Skipping bundling for Simulator platform"       
  exit 0;       

This has been the only way I have been able to get this to work.