You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行React-Native iOS时出现RCT-Folly编译错误求助

解决React Native iOS编译时RCT-Folly的VirtualEventBase.cpp编译错误

编译错误信息:

ios/Pods/RCT-Folly/folly/io/async/VirtualEventBase.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'RCT-Folly' from project 'Pods')
(1 failure)

以下是经过验证的解决方案,按顺序尝试:

  • 清理Pod环境并重装依赖
    先进入ios目录执行清理操作:

    cd ios
    pod deintegrate
    pod clean
    rm -rf Podfile.lock
    pod install
    

    回到项目根目录后重新运行react-native run-ios

  • 调整RCT-Folly的编译配置
    打开ios目录下的Pods.xcodeproj,找到RCT-Folly目标:

    1. 进入「Build Settings」→「Apple Clang - Language」→「C++」,将「C++ Standard Library」设置为libc++ (LLVM C++ standard library with C++11 support)
    2. 检查「Build Settings」→「Architectures」,M系列芯片建议只保留arm64;Intel芯片则保留x86_64
    3. 按下Cmd+Shift+K清理Xcode缓存,然后重新编译项目
  • 升级React Native及相关依赖
    旧版本React Native可能存在RCT-Folly的兼容问题,尝试升级到稳定版:

    npm install react-native@latest --save
    cd ios
    pod install
    

    注意:升级前请备份项目,避免依赖冲突导致其他问题

  • M系列芯片专属处理
    如果你的Mac是M1/M2/M3芯片,尝试用Rosetta运行终端:

    1. 找到「终端」应用,右键选择「显示简介」
    2. 勾选「使用Rosetta打开」
    3. 重启终端后,重新执行pod install和react-native run-ios

内容的提问来源于stack exchange,提问作者irshad

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 01:01:11