When new Xcode build system is used, Xcode build fails to download third-party dependencies
See original GitHub issueWorkaround (edit by @hramos)
You may work around this by manually installing third party dependencies into your project. The following steps are based on the workaround provided by @lyon007 in #14382.
rm -rf node_modules/ && yarn cache clean && yarn install
andrm -rf ~/.rncache
cd node_modules/react-native/scripts
./ios-install-third-party.sh
If your network is slow, you can download the packages separately and move them to therncache
folder 1. folly-2016.10.31.00 2. double-conversion-1.1.5 3. glog-0.3.5 4. boost_1_63_0cd <Your-Project-Folder>/node_modules/react-native/third-party/glog-0.3.5
../../scripts/ios-configure-glog.sh
- Xcode Clean & Build
Original issue
- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
React Native Environment Info: System: OS: macOS High Sierra 10.13.6 CPU: x64 Intel® Core™ i7-4870HQ CPU @ 2.50GHz Memory: 103.23 MB / 4.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.9.0 - ~/.nvm/versions/node/v10.9.0/bin/node npm: 6.4.0 - ~/.nvm/versions/node/v10.9.0/bin/npm SDKs: iOS SDK: Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0 IDEs: Xcode: 10.0/10L221o - /usr/bin/xcodebuild npmPackages: react: 16.4.1 => 16.4.1 react-native: 0.56.0 => 0.56.0 npmGlobalPackages: react-native-cli: 2.0.1
Description
First build request after yarn or npm install does not succeed due to apparent timing of download, extract, and compile actions. Subsequent builds succeed until node_modules removed and yarn or npm install run again.
Similar to this closed issue: https://github.com/facebook/react-native/issues/18982
This is not a problem in the local development environment as the work around is to simply rerun the build command. However, with remote build environments (Buddybuild, App Center, etc) this becomes problematic.
Reproducible Demo
Follow these steps:
0 - configure environment as per react-native info above 1 - from shell - react-native init DoubleTrouble 2 - from shell - cd DoubleTrouble 3 - from shell - react-native run-ios
Here is the tail end of output I received:
** BUILD FAILED **
The following build commands failed:
CompileC /Users/mcclen/Developer/DoubleTrouble/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/strtod.o /Users/mcclen/Developer/DoubleTrouble/node_modules/react-native/third-party/double-conversion-1.1.5/src/strtod.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/DoubleTrouble.app An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22): Failed to install the requested application The bundle identifier of the application could not be determined. Ensure that the application’s Info.plist contains a value for CFBundleIdentifier. Print: Entry, “:CFBundleIdentifier”, Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/DoubleTrouble.app/Info.plist Print: Entry, “:CFBundleIdentifier”, Does Not Exist
Issue Analytics
- State:
- Created 5 years ago
- Reactions:83
- Comments:131 (29 by maintainers)
Ok, I think I have a temporary fix to get React Native to work with Xcode 10—change the shared project settings (or shared workspace settings if you’re also using Cocoapods) to use the “Legacy Build System”. File->Project/Workspace Settings->Build System: Legacy Build System.
It’s (not really) surprising that Facebook hasn’t fixed this in the months that have passed since WWDC18. Good luck, everyone.
EDIT: This issue didn’t always happen in Xcode on the Mac. It regularly failed when I pushed to a CI system like BuddyBuild.
We ran into the same problem and fixed it by adding this as a
postinstall
step to our package.json:This will run the script in the correct directory which will make it pass later in the build process.