mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
5140d6438d
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38879 When creating a new app for iOS, you need to have Node installed properly and in the right paths in order for Xcode to pick it up. Xcode, by default, looks into the following folders for executables: - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/appleinternal/bin: - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin: - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec - /Applications/Xcodefb.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/bin - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/appleinternal/bin - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/usr/local/bin - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/local/bin - /Applications/Xcode.app/Contents/Developer/usr/bin - /Applications/Xcode.app/Contents/Developer/usr/local/bin - /usr/local/bin - /usr/bin - /bin - /usr/sbin - /sbin If `node` is not in one of them, our JS codegen scripts will fail to run. However, as soon as we run some scripts in Xcode, it is too late to properly look for node. We already had a cocoapod step, running before the build phase, which was creating the `.xode.env` file, setting `NODE_BINARY` to `$(command -v node)`. Unfortunately, when executed by Xcode, that's too late too. This change creates an `.xcode.env.local` file with the `$(command -v node)` command expanded, so I user can start working locally and quickly. We had multiple reports and issues related to this configuration online. For example: - https://www.reddit.com/r/reactnative/comments/15jpj0a/is_there_a_react_native_version_that_just_works/?utm_source=share&utm_medium=web2x&context=3 Note: we cannot automatically create simlinks to node in `/usr/local/bin` as it requires `sudo`. ## Changelog: [Internal] - Generate `.xcode.env.local` to simplify the creation of an app. Reviewed By: rshest Differential Revision: D48111724 fbshipit-source-id: 49cc6375bd80458d69adbc343ead6c4408805eee