Summary:
`react-native-xcode.sh` can fail to execute if `$REACT_NATIVE_DIR` contains spaces.
E.g. if `$REACT_NATIVE_DIR` was `/Users/samn/src/Xcode Projects/AwesomeReact` then `react-native-xcode.sh` would fail with the following error:
```
node /Users/samn/src/Xcode Projects/ReactNativeBeaconTest/node_modules/react-native/local-cli/cli.js bundle .... (elided)
module.js:341
throw err;
^
Error: Cannot find module '/Users/samn/src/Xcode'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:139:18)
at node.js:999:3
Command /bin/sh failed with exit code 1
```
This change properly handles paths with spaces in them by quoting `$REACT_NATIVE_DIR`
Closes https://github.com/facebook/react-native/pull/5651
Reviewed By: svcscm
Differential Revision: D2884600
Pulled By: androidtrunkagent
fb-gh-sync-id: 3784d8f4e16c0c2cadac738c5f085a5023b5ecf7
Summary:
This fixes an error introduced in `0.18.0-rc`
`node` and `npm` isn't available if the developer is using `nvm` or `nodeenv`. XCode throws an error because of the call to `npm`. Simple move the line to after `node` and `npm` has been setup.
Closes https://github.com/facebook/react-native/pull/5156
Reviewed By: svcscm
Differential Revision: D2807589
Pulled By: androidtrunkagent
fb-gh-sync-id: 30c33145b2cb6f30ff67f6648153d5aa67fb74ed
Summary:
Hello!
I'm a fan of the *env family of version managers over the *vm family as I find them simpler and less obtrusive, but it seems that they don't currently work so well with react-native on OSX. See #4645
I've made a small addition to the xcode script that resolves the issue for me. Hopefully others will find this useful too :)
If I've not made the right move here, what is the correct way to get react-native projects building in xcode when the binary is not in the $PATH used by the script?
Cheers,
Louis
Closes https://github.com/facebook/react-native/pull/4801
Reviewed By: svcscm
Differential Revision: D2770726
Pulled By: androidtrunkagent
fb-gh-sync-id: 3b0f9e466549b3012a68c94738d2556173f4c21e
Summary:
Related to issue https://github.com/facebook/react-native/issues/4034#issuecomment-164134543.
The npm global install path may be set to a non-standard location. `react-native` is assumed to be in `PATH` but doesn't take into account the user's environment so building in Xcode fails:
~~~
react-native bundle --entry-file index.ios.js --platform ios --dev true --bundle-output [...]
../node_modules/react-native/packager/react-native-xcode.sh: line 48: react-native: command not found
Command /bin/sh failed with exit code 127
~~~
This fix uses `npm prefix -g` to get the bin location and adds it to `PATH`.
Closes https://github.com/facebook/react-native/pull/4749
Reviewed By: svcscm
Differential Revision: D2753215
Pulled By: androidtrunkagent
fb-gh-sync-id: 964d1a71ac1bf204545a594a9fa433a7bc367f35
Summary: When Node is installed with nvm, scripts invoked from Xcode need to set up nvm. This can be done either by sourcing .profile/.bash_profile/.bashrc/etc... or by sourcing nvm.sh directly -- this diff does the latter and handles the case where nvm may have been installed the official way (under ~/.nvm/nvm.sh AFAIK) or via homebrew.
Closes https://github.com/facebook/react-native/pull/4015
Reviewed By: svcscm
Differential Revision: D2633301
Pulled By: frantic
fb-gh-sync-id: 3c2b9b0d21887ba21d6f85f5d279314d50c1db28