Xcode and React Native love to complain about errors. I've found that with certain projects need this additional configuration step in order for it to actually run.
Here's what to do:
- Remove all currently installed node modules and caches, and re-install them.
rm -rf node_modules/ && yarn cache clean && yarn install
rm -rf ~/.rncache
- Manually install the third party dependencies by entering the following folder.
cd node_modules/react-native/scripts
./ios-install-third-party.sh
- Move the created folder into the root directory of react-native (you might need to remove it if it already exists).
mv ./third-party ../
- Configure the glog dependency by being in the right place and running the right script.
cd ../third-party/glog-0.3.4
../../scripts/ios-configure-glog.sh
- If the error "xcrun:_ error: SDK "iphoneos" cannot be located" occurs, you need to run the following script and then run step 4 again.
sudo xcode-select --switch /Applications/Xcode.app
-
Open up the
.xcodeproj
or.xcworkspace
file and select Project -> Clean Build Folder. -
Select iPhone X (or the device of your choice) and then select Project -> Build.
-
Click the run button if there are no errors.
References:
- Installing third party dependencies - facebook/react-native#20774
- Locating the iphoneos SDK - facebook/react-native#18408