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

pod install command doesn't update hermes pod #36945

Closed
retyui opened this issue Apr 18, 2023 · 32 comments
Closed

pod install command doesn't update hermes pod #36945

retyui opened this issue Apr 18, 2023 · 32 comments
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Version Info Platform: iOS iOS applications.

Comments

@retyui
Copy link
Contributor

retyui commented Apr 18, 2023

Description

When you update React Native version and then do pod install or npx pod-install it won't update Hermes

tested on react native: 0.70.8,0.71.6

React Native Version

0.71.6

Output of npx react-native info

System:
    OS: macOS 13.0.1
    CPU: (8) x64 Apple M1 Pro
    Memory: 33.12 MB / 16.00 GB
    Shell: 3.3.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 14.21.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 6.14.17 - /usr/local/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.12.0 - /Users/i/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 29, 30, 31, 32, 33
      Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0, 33.0.0
      System Images: android-30 | Google Play ARM 64 v8a, android-30 | Google APIs ATD ARM 64 v8a, android-32 | Google APIs ARM 64 v8a, android-32 | Google Play ARM 64 v8a, android-33 | Google APIs ARM 64 v8a, android-33 | Google APIs Intel x86 Atom_64, android-33 | Google Play ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.5 => 0.71.5 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

npx react-native init testPodInstall
cd testPodInstall
bundle install
cd ios; bundle exec pod install; cd ..
# Change react-native version from "0.71.6" to "0.71.5" in package.json
yarn install
bundle exec pod install --project-directory ios
# or
npx pod-install

Result ios/Podfil.lock

  - hermes-engine (0.71.6): // <--- Ops... HAVE TO BE "0.71.5"
    - hermes-engine/Pre-built (= 0.71.6)
  - hermes-engine/Pre-built (0.71.6)

Snack, code example, screenshot, or link to a repository

...

@github-actions
Copy link

⚠️ Add or Reformat Version Info
ℹ️ We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.70.2

@cortinico
Copy link
Contributor

This feels like a bug that we want to investigate on. cc @cipolleschi

@jforaker
Copy link

jforaker commented Apr 19, 2023

Came here to say the same. This is problematic in CI.

Updating from 0.71.6 to 0.71.7 here's what we did:

yarn upgrade react-native@0.71.7 --exact
npx pod-install

...no mention of hermes-engine

Then in CI we have a couple steps before a Fastlane build:

    - cd ios
    - gem install bundler
    - bundle install
    - gem install cocoapods
    - pod install --repo-update

Yet this error occurs:


 CocoaPods could not find compatible versions for pod "hermes-engine":
  In snapshot (Podfile.lock):
    hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
  In Podfile:
    hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
It seems like you've changed the version of the dependency `hermes-engine` and it differs from the version stored in `Pods/Local Podspecs`.
You should run `pod update hermes-engine --no-repo-update` to apply changes made locally.

To resolve, we had to run pod update hermes-engine --no-repo-update locally and then push the Podfile.lock changes

@cipolleschi
Copy link
Contributor

Hi @jforaker, thanks for posting this.

A quick question to understand better: when you run

yarn upgrade react-native@0.71.7 --exact
npx pod-install

Was the app working? did this update the Podfile.lock?

Because, if that's the case, perhaps you missed to update the Podfile.lock.

Also, I see that you install bundler, but you are running all the commands without bundle exec, which, basically, is ignoring bundler completely. Is this done on purpose?

@jforaker
Copy link

Was the app working? did this update the Podfile.lock?

Yes it was working. Everything except the Hermes portion got updated in Podfile.lock

Also, I see that you install bundler, but you are running all the commands without bundle exec, which, basically, is ignoring bundler completely. Is this done on purpose?

@cipolleschi - not on purpose, I will revisit my CI steps as it’s been a long time since that was written.

@cipolleschi
Copy link
Contributor

Hi there, Sorry for the late answer.

Yes it was working. Everything except the Hermes portion got updated in Podfile.lock

Well, then it means that pod install is actually updating Hermes and that the Podfile.lock should be pushed to CI, no?
Isn't that expected that CI will fail if there is a file that is outdated? 🤔

@mikeswann
Copy link

Hi, I can confirm this issue when upgrading from 0.71.2 to 0.71.7.
After upgrading with react-native upgrade, the build locally succeeds, with the Pod lockfile still showing hermes-engine 0.71.2.
Building in CI pipeline without installed dependencies then fails.
deleting Gemfile.lock and Podfile. lock as well as the pods and vendors folder, then running:
bundle install -> bundle exec pod install
updated the hermes pod to 0.71.7 in the lock file successfully.

Kind Regards

@retyui
Copy link
Contributor Author

retyui commented Apr 27, 2023

Well, then it means that pod install is actually updating Hermes and that the Podfile.lock should be pushed to CI, no?
Isn't that expected that CI will fail if there is a file that is outdated? thinking

@cipolleschi when run pod install --project-directory ios or npx pod-install after RN version changing
it's updating all RN related pods except Hermes engine :(

and when I do cd ios; pod install; on CI or locally it fail with the next error:

 CocoaPods could not find compatible versions for pod "hermes-engine":
  In snapshot (Podfile.lock):
    hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
  In Podfile:
    hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
It seems like you've changed the version of the dependency `hermes-engine` and it differs from the version stored in `Pods/Local Podspecs`.
You should run `pod update hermes-engine --no-repo-update` to apply changes made locally.

and when you check Podfile.lock

  - FBReactNativeSpec (0.71.6): // the same that I have in package.json !!!
  - hermes-engine (0.71.5) // <-- OLD VERSION  

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Apr 27, 2023
@kerembalcan
Copy link

Hi, we also had the issue when updating from 0.71.6 to 0.71.7. Here are the logs from our last build in appcenter.
No such issue with the builds with version 0.71.6

[command]/usr/local/lib/ruby/gems/3.0.0/bin/pod install --repo-update
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `hermes-engine` from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`
[!] CocoaPods could not find compatible versions for pod "hermes-engine":
  In snapshot (Podfile.lock):
    hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
  In Podfile:
    hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
It seems like you've changed the version of the dependency `hermes-engine` and it differs from the version stored in `Pods/Local Podspecs`.
You should run `pod update hermes-engine --no-repo-update` to apply changes made locally.
[error]The process '/usr/local/lib/ruby/gems/3.0.0/bin/pod' failed with exit code 1
[error]The 'pod' command failed with error: The process '/usr/local/lib/ruby/gems/3.0.0/bin/pod' failed with exit code 1

@retyui retyui changed the title pod install --project-directory ios command doesn't update hermes pod pod install command doesn't update hermes pod Apr 27, 2023
@cipolleschi
Copy link
Contributor

@retyui @kerembalcan Thank you for the detailed log.

I hope to find some time to look into that. Probably, it could be reproduced easily by creating an app with 0.71.6 and upgrading it to 0.71.7.

What do you guys usually do when updating a patch of an app?
Just run npx react-native upgrade and then yarn and pod install?

@retyui
Copy link
Contributor Author

retyui commented Apr 28, 2023

What do you guys usually do when updating a patch of an app?

I do yarn install then pod install that's it.

P.S. npx react-native upgrade didn't work for me, I manually apply required changes

@mikeswann
Copy link

@cipolleschi
Im using different machines cause of mac so on win, npx react-native upgrade, commit that,
then on mac: npm install, bundle install, cd ios && bundle exec pod install.
dont quote me on the bundle install, i might have used just pod install.
Interestingly, local mac build succeeded. However, in CI without cached pods or gems, the issue appears.
Hope this helps.

@cipolleschi
Copy link
Contributor

I just run a quick test:

rn init TestHermesUpgrade --version 0.71.6  --skip-install
cd TestHermesUpgrade
yarn
cd ios
pod install
cd ..
git init && git add -A && git commit -m "initial commit"

Then, I opened the package.json and bumped the version of React Native:

	},
  "dependencies": {
    "react": "18.2.0",
-    "react-native": "0.71.6"
+    "react-native": "0.71.7"
  },

Then run again:

yarn
cd ios
pod install

And this is my git status output.

Screenshot 2023-04-28 at 13 26 15

But effectively, the hermes-engine entry in the Podfile.lock has not changed... 🤔

@cipolleschi
Copy link
Contributor

I think I found the problem. Here, we are defining that the hermes-engine pod must be installed using the specific podspec that is found at this path. However, it seems that with that option, Cocoapods is not able to determine whether the version changes.

Instead, by using :path, as the other local pods, and then doing pod install, it seems that the Podfile.lock properly shows the hermes versions:

Screenshot 2023-04-28 at 13 41 15

I'm setting up a PR to address this.

cipolleschi added a commit to cipolleschi/react-native that referenced this issue Apr 28, 2023
Summary:
This should fix facebook#36945, which is also causing annoyance when doing the releases

## Changelog:
[iOS][Changed] - Use :path instead of :podspec to let cocoapods recognize Hermes updates

Differential Revision: D45394241

fbshipit-source-id: 05f772f6033fe6c4215ffddb5601da3e8748b80a
@thomasender
Copy link

so, is there a fixed release yet? Running into the same issue here after updating to 0.71.7

@cipolleschi
Copy link
Contributor

There is a fix for 0.72, but we couldn't backport it to 0.71, unfortunately. :(

This is the fix: 8de71e5

@dylmye
Copy link

dylmye commented May 16, 2023

Thanks for sharing the fix! Considering that 0.72 isn't production-ready yet, what is the remedy in the meanwhile?
Thank you in advance!

@cipolleschi
Copy link
Contributor

The remedy so far would be to run pod update hermes-engine --no-repo-update and push the updated podfile.lock, or to add a step in CI that run pod update hermes-engine --no-repo-update if the previous pod install failed.

We are looking into backporting the fix also to 0.70 and 0.71 at least, but we don't have a patch release scheduled yet for those versions, unfortunately.

@retyui
Copy link
Contributor Author

retyui commented Jun 30, 2023

fixed

@retyui retyui closed this as completed Jun 30, 2023
@prateekuttreja2020
Copy link

fixed

is it fixed in 0.72... any update ?

@cipolleschi
Copy link
Contributor

Yes 8de71e5 has been shipped to 0.72.

@dylmye
Copy link

dylmye commented Jul 11, 2023

This is still an issue I encountered when upgrading to 0.72.1 and 0.72.2 🙃

@cipolleschi
Copy link
Contributor

That's expected. hermes-engine didn't changed between 0.71.2 and 0.72.2.
So, the :tag specified here is not changed and cocoapods keeps the old version as the two engines are the same.

Are you encountering issues while working on the app?

@github-actions github-actions bot added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Jul 20, 2023
@dylmye
Copy link

dylmye commented Jul 20, 2023

So every upgrade we will need to run pod update hermes-engine --no-repo-update unless there is a new version of hermes-engine released? That seems clunky + should be documented properly if so, in my opinion.

@cipolleschi
Copy link
Contributor

Are you encountering issues while working on the app?

So every upgrade we will need to run pod update hermes-engine --no-repo-update unless there is a new version of hermes-engine released? That seems clunky + should be documented properly if so, in my opinion.

So... you are encountering a problem! :D

No, this should not happen! thank you for signalling this. I'll put it in my queue and I hope to find a solution before the next release.

@cipolleschi cipolleschi reopened this Jul 21, 2023
@dylmye
Copy link

dylmye commented Jul 21, 2023

Apologies if it came off as rude, I thought you meant more if it was affecting any other part of the development workflow. Thanks for looking into it :)

@coofzilla
Copy link

I experienced this from 0.71.8-> 0.72.5. The previously solution of pod update hermes-engine --no-repo-update worked for me.

@elliottkember
Copy link
Contributor

I'm seeing it, too – am I correct in understanding that the fix in 0.72 will resolve this when updating from 0.72 to future versions? If so, thank you!

@pratt3351
Copy link

I'm facing this issue in react-native in version 0.72.7
when i run build on circle ci, this error occurs

any updates..?

@pratt3351
Copy link

in my case, in circle ci remain cache data.

i just run cache clean and build, it's fixed

@marksyzm
Copy link

I've been going around in circles with this and not been able to install Hermes Engine at all - does anyone have something like this going on? It keeps finding another copy of hermes and refusing to carry on:

Command

/opt/homebrew/Cellar/cocoapods/1.15.0/libexec/bin/pod update RCT-Folly boost --no-repo-update --verbose

Stack

   CocoaPods : 1.15.0
        Ruby : ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
    RubyGems : 3.5.5
        Host : macOS 14.2.1 (23C71)
       Xcode : 15.2 (15C500b)
         Git : git version 2.39.3 (Apple Git-145)
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.3.0/lib
Repositories : cocoapods - git - https://github.com/CocoaPods/Specs.git @ 070b38040f153da98cab3b16ee2e2c7a71263029

               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_relative '../node_modules/react-native-permissions/scripts/setup'

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 'InTune' 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

setup_permissions([
  'Microphone'
])

Error

Errno::EEXIST - File exists @ syserr_fail2_in - /Users/melphinstone/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'

@cipolleschi
Copy link
Contributor

This is a known issue that manifested earlier today because Cocoapods released version 1.15 which is breaking. Please refer to #42698 for updates.
We are working on it.

The workaround for the time being is to downgrade to Cocoapods 1.14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Version Info Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging a pull request may close this issue.