Appcenter构建React Native时出现Errno::EEXIST文件已存在错误
React Native Appcenter构建失败:Errno::EEXIST - File exists错误(hermes-engine安装失败)
在Appcenter上构建React Native项目时,遇到Errno::EEXIST - File exists @ syserr_fail2_in错误,错误路径指向:/Users/runner/Library/Caches/CocoaPods/Pods/External/hermes-engine/1093ead2a8c068cdef04abc8f93419c7-4438d/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/Resources
依赖版本
{ "appcenter": "4.4.5", "appcenter-analytics": "4.4.5", "appcenter-crashes": "4.4.5", "react-native": "0.71.7" }
构建环境信息
Appcenter日志显示安装hermes-engine失败,环境详情:
### Stack CocoaPods : 1.15.0 Ruby : ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-darwin21] RubyGems : 3.5.5 Host : macOS 12.7.3 (21H1015) Xcode : 14.2 (14C18) Git : git version 2.43.0 Ruby lib dir : /usr/local/Cellar/ruby@3.0/3.0.6_1/lib Repositories : trunk - CDN - https://cdn.cocoapods.org/
解决方法
- 清理CocoaPods缓存:在Appcenter构建脚本中添加
pod cache clean --all命令,清除缓存避免文件冲突。 - 强制重新安装依赖:执行
pod install --repo-update --clean-install,跳过现有缓存,重新拉取并安装所有Pod依赖。 - 调整CocoaPods版本:CocoaPods 1.15.0存在xcframework处理的已知问题,可尝试升级到1.15.2+或降级到1.14.3版本。
- 添加Podfile钩子处理冲突:在项目Podfile中加入post_install钩子,提前清理重复的Resources目录:
post_install do |installer| installer.pods_project.targets.each do |target| next unless target.name == 'hermes-engine' resource_dir = target.product_reference.dirname + 'Resources' FileUtils.rm_rf(resource_dir) if File.exist?(resource_dir) end end
- 关闭构建缓存:在Appcenter的构建配置中,关闭"Enable cache"选项,强制每次构建重新拉取依赖。
内容的提问来源于stack exchange,提问作者Riku
相关产品推荐
相关产品推荐

