For me this error showed up after upgrading React Native from 0.69 to 0.72.
Suprisingly all that was needed was to:
Remove all the derived data and rebuild:
rm -rf ~/Library/Developer/Xcode/DerivedData && npx react-native run-ios
If still doesn't work then
1. Make sure metro server is stopped and run a full cache clean:
watchman watch-del-all && rm -rf ios/build && rm -rf ~/Library/Developer/Xcode/DerivedData && rm -rf node_modules && yarn install && cd ios && rm -rf Pods && pod install && cd .. && npx react-native run-ios
Note: if pod install fails take a deep looks at the pod errors
2. Attempt to build with Xcode and look deep into any errors triggered at Xcode build process
Additional notes:
this question is possibly a duplicate of error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65