react-native run-ios fails to build

Viewed 5420

I have an existing project, that have been tested on an windows + android setup. Now I'm trying to run it on a macbook to test on an Iphone 11 simulator.

  • react-native-cli: 2.0.1
  • react-native: 0.64.0

I install the pod file and try to run

react-native run-ios

I get a the following error:

** BUILD FAILED **

The following build commands failed: CompileC [USER]/Library/Developer/Xcode/DerivedData/andon-hkuetryxdipcrgbcxnseaqnfnaqp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/ReactCommon.build/Objects-normal/x86_64/RCTTurboModuleManager.o [PROJECT_PATH]/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (1 failure)

3 Answers

Probably very late to answer.

I started facing this issue after I upgraded from 0.63.4 to 0.64.2.

If we run from command line was not getting any way to find out the error. When I ran from x-code, found following error message,

/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm:172:8: 'shared_timed_mutex' is unavailable: introduced in iOS 10.0

The reason for that was the following entry in my podfile,

config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'

After I deleted the above entry it started working like a charm.

ref: https://github.com/facebook/react-native/issues/31250#issuecomment-808312355

enter image description here enter image description here

  • Under XCode top menu, Goto XCode->Preferences -> Locations -> Open Derived Data folder(By clicking the arrow button) (Find screenshot for your references)

  • Finder will open Derived Data folder,

  • Delete Derived Data Folder

  • Start Metro server using npm start or yarn start

  • Perform Clean build using cmd+shift+k

  • Run the application using cmd+r

I encountered this problem while running a React Native iOS app on macOS. After researching the issue for hours I was able to resolve it with these steps:

  1. Clear the cache of pod by running these commands:

    rm -rf ~/Library/Caches/CocoaPods

    rm -rf Pods

    rm -rf ~/Library/Developer/Xcode/DerivedData/*

    pod deintegrate

    pod setup

  2. Navigate to the ios directory, and delete the Pods directory

  3. While still in the ios directory, run pod install

  4. Navigate back to the project directory, and run npx react-native run-ios

Hope this helps you too!

Related