React Native 0.73.4升级后Xcode归档报错:多命令生成folly.framework
React Native 0.73.4 Xcode归档报错:Multiple commands produce folly.framework
问题描述
升级React Native到0.73.4版本后,执行Xcode归档操作时触发以下错误:
Multiple commands produce '/Users/user/Library/Developer/Xcode/DerivedData/MyKeyPaaS-dvusobjtabyvaehceuotkxpwtbph/Build/Intermediates.noindex/ArchiveIntermediates/ProjectName/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/folly.framework'
补充报错详情:
Target 'RCT-Folly.common' (project 'Pods') has create directory command with output '/Users/robert.coroianu/Library/Developer/Xcode/DerivedData/MyKeyPaaS-dvusobjtabyvaehceuotkxpwtbph/Build/Intermediates.noindex/ArchiveIntermediates/MyKeyPaaS/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/folly.framework' Target 'RCT-Folly.common-Fabric' (project 'Pods') has create directory command with output '/Users/robert.coroianu/Library/Developer/Xcode/DerivedData/ProjectName-dvusobjtabyvaehceuotkxpwtbph/Build/Intermediates.noindex/ArchiveIntermediates/ProjectName/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/folly.framework'
注:项目的开发构建(Dev Build)运行完全正常。
解决方案
方法1:清理Pod缓存并重新安装
- 执行命令清理Pod相关文件:
rm -rf Pods/ Podfile.lock pod cache clean --all
- 重新安装Pods:
pod install
- 清理Xcode构建缓存:打开Xcode,按
Cmd+Shift+K清理构建文件夹,再按Cmd+Option+Shift+K清理派生数据。
方法2:修改Podfile排除重复Target
在Podfile末尾添加以下代码,强制跳过重复Target的安装:
post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'RCT-Folly.common-Fabric' target.build_configurations.each do |config| config.build_settings['SKIP_INSTALL'] = 'YES' end end end end
添加后重新执行pod install,再尝试归档。
方法3:调整Xcode归档配置
打开Xcode的项目导航栏,找到Pods项目下的RCT-Folly.common-Fabric Target:
- 进入
Build Settings标签页 - 搜索
Skip Install选项 - 将Release/Archive配置下的
Skip Install设置为YES
方法4:检查依赖版本一致性
通过npm list react-native查看项目依赖树,确保所有React Native相关依赖(如react-native、react-native-fabric等)的版本与0.73.4兼容,避免因依赖冲突生成重复Target。
内容的提问来源于stack exchange,提问作者Robert Coroianu
相关产品推荐
相关产品推荐

