【问题标题】:React Native showing error while making a build in iOS - Build failed The following build commands failed: CompileC在 iOS 中进行构建时 React Native 显示错误 - 构建失败以下构建命令失败:CompileC
【发布时间】:2021-09-23 00:31:04
【问题描述】:

一切正常。我刚刚做了 npm audit fix 并且出现了这个错误。

我做过但没用的事情:

我删除了节点模块并重新安装了它们。删除了 podfile.lock 并尝试了命令 pod install。关闭 Xcode 并重新启动它。我尝试了许多替代 * 解决方案,但没有奏效。谁能帮我解决这个问题?

=== BUILD TARGET toolbar-android OF PROJECT Pods WITH CONFIGURATION Debug ===

Check dependencies


** BUILD FAILED **


The following build commands failed:
        CompileC /Users/jindalsaw/Library/Developer/Xcode/DerivedData/PipeApp-egsumunmosmxkzatcgfjoitkddtm/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNGestureHandler.build/Objects-normal/x86_64/RNGestureHandlerManager.o /Users/jindalsaw/Desktop/zzzz/ReactApp_mobile/PipeApp/node_modules/react-native-gesture-handler/ios/RNGestureHandlerManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

我的播客文件:

require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native/scripts/react_native_pods'

platform :ios, '14.2'


target 'PipeApp' do
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])

  pod 'RNFS', :path => '../node_modules/react-native-fs'

  target 'PipeAppTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'PipeApp-tvOS' do
  # Pods for RNTodo-tvOS

  target 'PipeApp-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

【问题讨论】:

    标签: reactjs swift xcode react-native npm


    【解决方案1】:

    尝试使用rosetta 运行Xcode: 右键 Xcode > 获取信息 > 使用 Rosetta 打开

    或者从终端运行 npx react-native run 在一个和 arch -x86_64 npm run ios 在另一个

    【讨论】:

      【解决方案2】:

      这可能是 XCode 的缓存错误。

      打开 Xcode 点击文件 -> 工作区设置 -> 点击派生数据并删除派生数据文件夹。清理并重新构建。

      我附上了屏幕截图,点击哪里可以导出数据文件夹。

      我希望这会有所帮助。

      【讨论】:

        最近更新 更多