I followed the official react-native setup guide to set up my react-native project. (installing all required packages + npx react-native init MyProject
+ npx react-native start
(Terminal 1) + npx react-native run-ios
(Terminal 2)) However, I get an error when trying to build the ios application. This Stackoverflow post did not seem to help.
I would highly appreciate if you could help me out. This is my first react-native setup so I have no idea how to fix that error.
Here is the full output when running npx react-native run-ios
:
(base) Lucas-MacBook-Pro-2:MyProject luca$ npx react-native run-ios
info Found Xcode workspace "MyProject.xcworkspace" info Launching
iPhone 13 (iOS 15.2) info Building (using "xcodebuild -workspace
MyProject.xcworkspace -configuration Debug -scheme MyProject
-destination id=D3DC5A60-6CB5-40B5-B610-4760B38C1941") error Failed to build iOS project. We ran "xcodebuild" command but it exited with
error code 65. To debug build logs further, consider building your app
with Xcode.app, by opening MyProject.xcworkspace. Command line
invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace MyProject.xcworkspace -configuration Debug -scheme MyProject -destination id=D3DC5A60-6CB5-40B5-B610-4760B38C1941User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YESnote: Using new build system note: Planning Analyze workspace
Create build description Build description signature:
58652ba6d5e25b644cfcef8d1c74529a Build description path:
/Users/luca/Library/Developer/Xcode/DerivedData/MyProject-eqgmgatmlgqlskcmpchtodpmmbab/Build/Intermediates.noindex/XCBuildData/58652ba6d5e25b644cfcef8d1c74529a-desc.xcbuildnote: Build preparation complete note: Building targets in dependency
order error: unable to attach DB: error: accessing build database
"/Users/luca/Library/Developer/Xcode/DerivedData/MyProject-eqgmgatmlgqlskcmpchtodpmmbab/Build/Intermediates.noindex/XCBuildData/build.db":
database is locked Possibly there are two concurrent builds running in
the same filesystem location.2022-05-08 12:19:42.347 xcodebuild[2512:185622] Requested but did not
find extension point with identifier
Xcode.IDEKit.ExtensionSentinelHostApplications for extension
Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in
com.apple.dt.IDEWatchSupportCore 2022-05-08 12:19:42.353
xcodebuild[2512:185622] Requested but did not find extension point
with identifier
Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of
plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **
To check all version information, here is the output of npx react-native info
:
System:
OS: macOS 12.0.1
CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
Memory: 31.59 MB / 8.00 GB
Shell: 3.2.57 – /bin/bash
Binaries:
Node: 14.16.1 – /usr/local/bin/node
Yarn: Not Found
npm: 6.14.12 – /usr/local/bin/npm
Watchman: 2022.03.21.00 – /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 – /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5977832
Xcode: 13.3.1/13E500a – /usr/bin/xcodebuild
Languages:
Java: 16.0.1 – /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.1 => 0.68.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
3
Answers
Quick fix:
Manually download Xcode Command Line Tools from https://developer.apple.com
Activate downloaded command line tools using
sudo xcode-select -s /Library/Developer/CommandLineTools
Restart Xcode
(only for official react-native setup): Comment out these lines from ios/Podfile:
use_flipper!()
# post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
(only for official react-native setup): Run
pod update
Description of what went wrong: I was finally able to fix the problem. Since I simply followed the setup guide for MacOs as described here, I think it is useful to elaborate on what I did in to fix the issue described above. Some people may face the same difficulties.
First things first: The underlying error is caused by Xcode itself.
is only the consequence of the other two errors from the output, namely
These errors occur when running the application for the first time. When trying to restart the application, the earlier instance of the program still tries to access the database which causes the error.
Therefore, I will explain how to fix the missing dependencies
Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS
andXcode.DebuggerFoundation.AppExtensionHosts.watchOS
. I found out how to fix that error based on this Apple Community post. In my case, I had to manually install Xcode Command Line Tools from the Apple Developer Website. Next, Xcode has to integrate these downloaded command line tools usingsudo xcode-select -s /Library/Developer/CommandLineTools
. Once you have restarted Xcode and followed the official setup guide from react-native you will face another build error.This error will occur because the initial Xcode configuration collides with the Podfile generated by
npm react-native init MyProject
on ios. To fix this, comment out lines from the podfile (see 4.) and after runningpod update
, your setup of react-native should finally work.I hope that I was able to help a couple of lost developers who want to get started with React Native for ios Apps.
In my case I just select Command Line Tools inside Xcode preferences
I fixed running only:
Already had the command line tools installed, and I’m not using any react, I guess the issue was caused by switching xcode versions recently.