Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command pod install failed - Cause: Error installing hermes-engine #26828

Closed
ferologics opened this issue Jan 31, 2024 · 10 comments
Closed

Command pod install failed - Cause: Error installing hermes-engine #26828

ferologics opened this issue Jan 31, 2024 · 10 comments
Labels
CLI Versioned Expo CLI -- `npx expo start`

Comments

@ferologics
Copy link
Contributor

ferologics commented Jan 31, 2024

Summary

When expo prebuild runs pod install it fails with:

Command `pod install` failed.
└─ Cause: Error installing hermes-engine
Click to expand the full error ❗ 👈 👀

Command

/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/bin/pod install --repo-update --ansi

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.15.0
        Ruby : ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
    RubyGems : 3.5.4
        Host : macOS 14.3 (23D56)
       Xcode : 15.2 (15C500b)
         Git : git version 2.42.1
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.3.0/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")

require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}

ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0'
ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']

platform :ios, podfile_properties['ios.deploymentTarget'] || '13.4'
install! 'cocoapods',
  :deterministic_uuids => false

prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...), which will be excluded. To fix this,
# you can also exclude `react-native-flipper` in `react-native.config.js`
#
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
#   }
# }
# ```
flipper_config = FlipperConfiguration.disabled
if ENV['NO_FLIPPER'] == '1' then
  # Explicitly disabled through environment variables
  flipper_config = FlipperConfiguration.disabled
elsif podfile_properties.key?('ios.flipper') then
  # Configure Flipper in Podfile.properties.json
  if podfile_properties['ios.flipper'] == 'true' then
    flipper_config = FlipperConfiguration.enabled(["Debug", "Release"])
  elsif podfile_properties['ios.flipper'] != 'false' then
    flipper_config = FlipperConfiguration.enabled(["Debug", "Release"], { 'Flipper' => podfile_properties['ios.flipper'] })
  end
end

target 'quickstartexpo' do
  use_expo_modules!
  config = use_native_modules!

  use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
  use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    # Note that if you have use_frameworks! enabled, Flipper will not work if enabled
    :flipper_configuration => flipper_config
  )

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )

    # This is necessary for Xcode 14, because it signs resource bundles by default
    # when building for devices.
    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end

  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
end

Error

Errno::EEXIST - File exists @ syserr_fail2_in - /Users/zen/Library/Caches/CocoaPods/Pods/External/hermes-engine/6ef44e4a609ea85b35328bf8b605bebb-b361c/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/Resources
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2254:in `symlink'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2254:in `copy'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:1048:in `block in copy_entry'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2385:in `wrap_traverse'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2388:in `block in wrap_traverse'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2387:in `each'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2387:in `wrap_traverse'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:1045:in `copy_entry'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:990:in `block in cp_r'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2469:in `block in fu_each_src_dest'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2478:in `block in fu_each_src_dest0'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2476:in `each'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2476:in `fu_each_src_dest0'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2467:in `fu_each_src_dest'
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:989:in `cp_r'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:343:in `block (2 levels) in copy_files'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:341:in `each'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:341:in `block in copy_files'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:128:in `lock'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:99:in `write_lock'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:332:in `copy_files'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:269:in `block (2 levels) in uncached_pod'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:265:in `each'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:265:in `block in uncached_pod'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:291:in `in_tmpdir'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:238:in `uncached_pod'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:33:in `download_pod'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader.rb:42:in `download'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer/pod_source_downloader.rb:69:in `download!'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer/pod_source_installer.rb:117:in `download_source'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer/pod_source_installer.rb:67:in `install!'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:621:in `install_source_of_pod'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:539:in `block (2 levels) in install_pod_sources'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/user_interface.rb:86:in `titled_section'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:538:in `block in install_pod_sources'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:535:in `each'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:535:in `install_pod_sources'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:258:in `block in download_dependencies'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:257:in `download_dependencies'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:163:in `install!'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/command/install.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/bin/pod:25:in `<main>'

What platform(s) does this occur on?

Android, iOS

SDK Version

50.0.4

Environment

  expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.3
      Shell: 3.6.0 - /opt/homebrew/bin/fish
    Binaries:
      Node: 21.1.0 - /opt/homebrew/bin/node
      Yarn: 1.22.19 - /opt/homebrew/bin/yarn
      npm: 10.2.0 - /opt/homebrew/bin/npm
    Managers:
      CocoaPods: 1.15.0 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
      Android SDK:
        API Levels: 33
        Build Tools: 30.0.3, 33.0.0
        System Images: android-33 | Google APIs ARM 64 v8a
    IDEs:
      Android Studio: 2022.2 AI-222.4459.24.2221.10121639
      Xcode: 15.2/15C500b - /usr/bin/xcodebuild
    npmPackages:
      expo: ~50.0.4 => 50.0.4 
      react: 18.2.0 => 18.2.0 
      react-native: 0.73.2 => 0.73.2 
    npmGlobalPackages:
      eas-cli: 3.7.2
    Expo Workflow: bare

Minimal reproducible example

run just setup in the project:
quickstart-expo.zip

@ferologics ferologics added CLI Versioned Expo CLI -- `npx expo start` needs validation Issue needs to be validated labels Jan 31, 2024
@expo-bot expo-bot removed the needs validation Issue needs to be validated label Jan 31, 2024
@HugoGresse
Copy link

HugoGresse commented Jan 31, 2024

This issue needs more attention. Potential solution:

  • the cocoapods version installed by the CocoaPodsPackageManager somewhere here should match the gemfile one
  • let the user have an option to set it:
source "https://rubygems.org"
ruby ">= 2.6.10"
gem 'cocoapods', '1.14.3' #https://github.com/facebook/react-native/issues/42698
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'

Related issue:

@brentvatne
Copy link
Member

we detect this in EAS Build and warn:

GFCBTwsbQAAyL8l

unlike in the React Native template in the facebook/react-native repo, we don't provide a specific version of CocoaPods in Expo projects - so you can downgrade your installed CocoaPods version to 1.14.3 to fix this.

gem install cocoapods -v 1.14.3

@brentvatne
Copy link
Member

we should follow up on this further by adding a validation to expo-doctor. cc @keith-kurak

@HugoGresse
Copy link

I'm using pod-install without expo, so I had to use the trusty

            - name: Change cocoapods version
              run: sudo gem install cocoapods -v 1.14.3 #https://github.com/facebook/react-native/issues/42698

It could be nice if this module used the COCOAPODS: 1.14.3 defined in the Podfile.lock as other GitHub action does.

@jamespageced
Copy link

jamespageced commented Feb 9, 2024

I've tried pre-installing the cocoapods with the azure pipelines and the prebuild command still targets the latest version of cocoapods.

Then I read you can setup the eas.json config to specify the cocoapods version, however we are not using eas. We have our own keystore file to generate apk/ipa files. So instead we use prebuild.

Is there a way to specify the cocoapods version with expo's prebuilt command? For example npx expo prebuild --platform ios --clean --npm

Or is there a way to set up a targeted version in the app.json config file for expo?

More details on what I have tried can be found here: https://stackoverflow.com/questions/77969596/expo-prebuild-with-specific-cocoapods-version

@RL-Jurica-Penjgusic
Copy link

RL-Jurica-Penjgusic commented Feb 13, 2024

I have successfully build on azure pipelines when running this command.

  • task: PowerShell@2
    displayName: Use cocoapods 1.14.3
    inputs:
    targetType: 'inline'
    script: |
    gem uninstall cocoapods
    gem install cocoapods -v 1.14.3

@brentvatne
Copy link
Member

brentvatne commented Feb 14, 2024

@jamespageced - you can install whichever cocoapods version you want prior to running prebuild and it will be used by prebuild. alternatively, pass in --no-install to prebuild and then handle running pod install on your own separately

@dconlisk
Copy link

dconlisk commented Feb 14, 2024

To follow up on @RL-Jurica-Penjgusic 's answer, I had problems uninstalling cocoapods, so I use the following task in my pipeline:

  • task: PowerShell@2
    displayName: Downgrade cocoapods to version 1.14.3
    inputs:
    targetType: "inline"
    script: |
    pod --version
    gem uninstall cocoapods -v 1.15.0 --ignore-dependencies
    gem install cocoapods -v 1.14.3

Note the use of the --ignore-dependencies flag

@vandenbergrobin
Copy link

@dconlisk thanks, I have applied this to our Azure pipeline and it fixed it. I don't like it but it unblocks us for now.

@karlhorky
Copy link
Contributor

karlhorky commented Feb 17, 2024

Running pnpm expo prebuild --platform ios on GitHub Actions (runs-on: macos-12), we had to uninstall CocoaPods and install the fixed version 1.15.2 in a previous step:

      # CocoaPods version 1.15.0 has incompatibilities with React Native
      # https://github.com/facebook/react-native/issues/42698
      # https://github.com/expo/expo/issues/26828
      # https://github.com/CocoaPods/CocoaPods/issues/12226
      - name: Upgrade CocoaPods to version 1.15.2
        run: |
          gem uninstall cocoapods -v 1.15.0 --ignore-dependencies
          gem install cocoapods -v 1.15.2

      - name: Prepare files for xcodebuild command
        run: pnpm expo prebuild --platform ios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Versioned Expo CLI -- `npx expo start`
Projects
None yet
Development

No branches or pull requests

9 participants