SimonSataa-YuLarsen
SimonSataa-YuLarsen

Reputation: 61

react-native run-ios fails to build

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.

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)

Upvotes: 6

Views: 20204

Answers (5)

PatricioSantibanez
PatricioSantibanez

Reputation: 13

This problem is recurring, especially in the compatibility that macOS has with react native, but everything has a solution, sometimes forced, but there is a solution.

In your ios folder (ios cd) execute the following steps.

rm -rf ~/Library/Caches/CocoaPods

rm -rf Pods

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

pod deintegrate

pod setup

After you have done this, execute:

pod install

Continue with yarn install or npm install to run metro, if metro does not open, the application will not open.

After these steps, run npx react-native run-ios, the app should open, in case it does not open and gives you an error, open it directly from the simulator and do the building.

I will continue looking for solutions and exposing them.

PD: If my English is poor, excuse me, I am from Chile and I am learning the language.

Upvotes: 0

starterProgrammer
starterProgrammer

Reputation: 302

I struggled to build react native project in iOS with this issue. And I did build after following processes.

1- Clear the cache of pod with

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup

2- And delete the project's Pods directory. The location of it is project directory > ios > Pods. 3- Then in the project directory > ios location, install pod with pod install 4- And npx react-native run-ios in project directory

This is worked for me perfectly... for more information you can check this link in github

Upvotes: 0

Green
Green

Reputation: 1761

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!

Upvotes: 4

Gokul Kulkarni
Gokul Kulkarni

Reputation: 2259

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

Upvotes: 1

Elambaruthi K
Elambaruthi K

Reputation: 21

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

Upvotes: 0

Related Questions