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

React Native项目编译报错:Multiple commands produce hermes.framework

问题

克隆项目后,执行yarn和pod install完成依赖安装,但运行iOS项目时出现Multiple commands produce ... hermes.framework错误,具体报错如下:

Computing target dependency graph and provisioning inputs

Create build description
Build description signature: 2e78cab04f15c8767559401b0ac7acaf
Build description path: /Users/theobouwman/Library/Developer/Xcode/DerivedData/MomoApp-eiwjjdoutbjvuqghlrgnoaydnogo/Build/Intermediates.noindex/XCBuildData/2e78cab04f15c8767559401b0ac7acaf.xcbuilddata

note: Building targets in dependency order
error: Multiple commands produce '/Users/theobouwman/Library/Developer/Xcode/DerivedData/MomoApp-eiwjjdoutbjvuqghlrgnoaydnogo/Build/Products/Debug-iphoneos/Momo.app/Frameworks/hermes.framework'
    note: Target 'MomoApp' (project 'MomoApp') has copy command from '/Users/theobouwman/dev/projects/momo/momo-app/ios/Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework' to '/Users/theobouwman/Library/Developer/Xcode/DerivedData/MomoApp-eiwjjdoutbjvuqghlrgnoaydnogo/Build/Products/Debug-iphoneos/Momo.app/Frameworks/hermes.framework'
    note: That command depends on command in Target 'MomoApp' (project 'MomoApp'): script phase “[CP] Embed Pods Frameworks”
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-Codegen' from project 'Pods')
warning: Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MomoApp' from project 'MomoApp')
warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MomoApp' from project 'MomoApp')
warning: Run script build phase '[CP-User] [RNFB] Core Configuration' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MomoApp' from project 'MomoApp')
warning: Run script build phase '[CP-User] [RNFB] Crashlytics Configuration' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MomoApp' from project 'MomoApp')
warning: duplicate output file '/Users/theobouwman/Library/Developer/Xcode/DerivedData/MomoApp-eiwjjdoutbjvuqghlrgnoaydnogo/Build/Products/Debug-iphoneos/Momo.app/Frameworks/hermes.framework' on task: PhaseScriptExecution [CP] Embed Pods Frameworks /Users/theobouwman/Library/Developer/Xcode/DerivedData/MomoApp-eiwjjdoutbjvuqghlrgnoaydnogo/Build/Intermediates.noindex/MomoApp.build/Debug-iphoneos/MomoApp.build/Script-9B4EE5F931DC2030C70542B5.sh (in target 'MomoApp' from project 'MomoApp')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'fmt' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-bridging' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RCT-Folly' from project 'Pods')

2023-05-30 22:42:18.227 xcodebuild[70948:321613] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
2023-05-30 22:42:18.640 xcodebuild[70948:321654]  DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot7/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-21677/DTDeviceKitBase/DTDKRemoteDeviceData.m:382
Details:  (null) deviceType from 00008101-000E19281468801E was NULL when -platform called.
Object:   <DTDKMobileDeviceToken: 0x7f9673b2f2e0>
Method:   -platform
Thread:   <NSThread: 0x6000028e8100>{number = 7, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2023-05-30 22:42:18.815 xcodebuild[70948:321639]  DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot7/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-21677/DTDeviceKitBase/DTDKRemoteDeviceData.m:382
Details:  (null) deviceType from 00008101-000E19281468801E was NULL when -platform called.
Object:   <DTDKMobileDeviceToken: 0x7f9673b2f2e0>
Method:   -platform
Thread:   <NSThread: 0x600002714000>{number = 6, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2023-05-30 22:42:18.877 xcodebuild[70948:321639]  DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot7/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-21677/DTDeviceKitBase/DTDKRemoteDeviceData.m:382
Details:  (null) deviceType from 00008101-000E19281468801E was NULL when -platform called.
Object:   <DTDKMobileDeviceToken: 0x7f9673b2f2e0>
Method:   -platform
Thread:   <NSThread: 0x600002714000>{number = 6, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **

环境信息

React Native版本:0.70.5
npx react-native info输出:

System:
    OS: macOS 13.4
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 23.95 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.5.1 - /usr/local/bin/npm
    Watchman: 2023.05.22.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /Users/theobouwman/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 14.3/14E222b - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.5 => 0.70.5 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

复现步骤

  1. 克隆项目后执行yarn安装JS依赖
  2. 进入ios目录执行pod install安装iOS依赖
  3. 运行Xcode或执行npx react-native run-ios启动项目,触发报错

项目截图

2023-05-30 22:48:51的截图


解决方案

这个错误是Xcode中存在两次复制hermes.framework的命令冲突导致的,以下是几种可行的解决方法:

方法一:移除手动添加的Hermes框架引用

从截图看,项目可能手动添加了hermes.framework,而CocoaPods也会自动处理Hermes嵌入,导致重复:

  1. 打开Xcode,选中项目目标MomoApp
  2. 切换到General标签页,找到Frameworks, Libraries, and Embedded Content区域
  3. 找到hermes.framework,点击减号(-)移除
  4. 按Cmd+Shift+K清理构建缓存,重新运行项目

方法二:调整Podfile配置并重新安装依赖

  1. 打开ios/Podfile,确保包含官方Hermes配置:
    use_react_native!(
      :path => config[:reactNativePath],
      :hermes_enabled => true
    )
    
  2. 删除ios/Pods目录和Podfile.lock文件
  3. 重新执行pod install
  4. 清理Xcode缓存后重新构建

方法三:删除重复的构建阶段命令

  1. 打开Xcode项目目标的Build Phases标签页
  2. 查找是否有手动添加的Copy Files阶段用于复制hermes.framework,同时保留CocoaPods自动生成的[CP] Embed Pods Frameworks阶段
  3. 删除手动添加的复制命令
  4. 清理并重新构建

方法四:清理Xcode DerivedData缓存

  1. 关闭Xcode
  2. 执行命令删除缓存目录:
    rm -rf ~/Library/Developer/Xcode/DerivedData
    
  3. 重新打开Xcode,清理项目后重新构建

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.20 14:55:01