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

Invalid hermes-engine.podspec file: undefined method `exists?' for File:Class #35807

Closed
leotm opened this issue Jan 11, 2023 · 7 comments
Closed

Comments

@leotm
Copy link
Contributor

leotm commented Jan 11, 2023

Description

npx react-native@next init RN071RC6 --version 0.71.0-rc.6
cd ios && pod install

Locally started noticing

...
[Codegen] Done.
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
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`
[!] Failed to load 'hermes-engine' podspec:
[!] Invalid `hermes-engine.podspec` file: undefined method `exists?' for File:Class.

 #  from /Users/leo/Documents/GitHub/react-native-template-new-architecture/node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec:46
 #  -------------------------------------------
 #    source[:http] = "file://#{destination_path}"
 >  elsif File.exists?(hermestag_file) && isInCI
 #    Pod::UI.puts '[Hermes] Detected that you are on a React Native release branch, building Hermes from source but fetched from tag...'.yellow if Object.const_defined?("Pod::UI")
 #  -------------------------------------------


[!] [Codegen] warn: using experimental new codegen integration

Same in template (0.71.0-rc.5)
But CI passing as normal
So seems to be my machine, not figured exactly what yet

This is getting me passed it atm as temp workaround

# node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec
- elsif File.exists?(hermestag_file) && isInCI
-   Pod::UI.puts '[Hermes] Detected that you are on a React Native release branch, building Hermes from source but fetched from tag...'.yellow if Object.const_defined?("Pod::UI")
-   hermestag = File.read(hermestag_file).strip
-   source[:git] = git
-   source[:tag] = hermestag

Result

...
Installing glog (0.3.5)
Installing hermes-engine (0.71.0-rc.6)
Installing libevent (2.1.12)
Generating Pods project
Setting REACT_NATIVE build settings
Setting CLANG_CXX_LANGUAGE_STANDARD to c++17 on /Users/leo/Documents/GitHub/RN071RC6/ios/RN071RC6.xcodeproj
Pod install took 14 [s] to run
Integrating client project

[!] Please close any current Xcode sessions and use `RN071RC6.xcworkspace` for this project from now on.
Pod installation complete! There are 59 dependencies from the Podfile and 49 total pods installed.

Version

0.71.0-rc.5-6

Output of npx react-native info

System:
    OS: macOS 13.2
    CPU: (8) arm64 Apple M1
    Memory: 219.19 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 19.4.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.2.0 - /opt/homebrew/bin/npm
    Watchman: 2023.01.09.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 19.0.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.0-rc.6 => 0.71.0-rc.6
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

npx react-native@next init RN071RC6 --version 0.71.0-rc.6
cd ios && pod install

On System info above

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

TODO

@leotm
Copy link
Contributor Author

leotm commented Jan 11, 2023

for anyone else was ruby v3.2 (via cocoapods 1.11.3) and rbenv improperly setup

ensuring ruby -v matches .ruby-version will successfully install each time i.e. 2.7.6 atm

checked temporarily with brew remove cocoapods (removing ruby 3.2) then npx pod-install (fetches correct versions)

after brew install rbenv ruby-build needed to rbenv init then echo 'eval "$(rbenv init -)"' >> ~/.zshrc then restart or source ~/.zshrc

now rbenv install detects/installs .ruby-version verified with ruby -v

@leotm leotm closed this as completed Jan 11, 2023
@leotm
Copy link
Contributor Author

leotm commented Jan 11, 2023

nb from rbenv

WARNING: ruby-2.7.6 is nearing its end of life.
It only receives critical security updates, no bug fixes.

my CI's passing on CocoaPods: 1.11.3 - /usr/local/lib/ruby/gems/3.0.0/bin/pod

so we can look into upgrading RN to Ruby 2.7.6+ soon (2.7.7-3.0.5 or 2.7.7-3.1.3 or 3.2+)

edit: thank you @spuyet

@dcsan
Copy link

dcsan commented Jan 12, 2023

we're on "react-native": "0.69.7", and I just started seeing this today for some reason

does the Pods installer use it's own ruby or the system ruby?
if the former, then I'm not sure why this might suddenly break.

It is indeed since File.exists is deprecated long long ago

image

I'm not clear what a workaround would be if this is part of the build process (in our case using expo).
My apple supplied system ruby is ancient enough that it still works, but somewhere in the rest of the process a different ruby is perhaps being found / used. How to patch and downgrade that?

@amochkin
Copy link

Quickfix:

sed -i .orig 's/File\.exists\?/File\.exist\?/g' node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec

@alainux
Copy link

alainux commented Jan 20, 2023

I just got this today in 0.71.0, after trying to do pod deintegrate, it would not get the correct version anymore. I had to update the react-native version to 0.71.1 following the upgrade guide to get it to work. For some reason, it seems like the hermes-engine version that is bootstrapped when initializing a project is correct.

@jeffngugi
Copy link

jeffngugi commented Mar 10, 2023

Quickfix:

sed -i .orig 's/File\.exists\?/File\.exist\?/g' node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec

Where do I add this?

@MustafaSaify
Copy link

Quickfix:

sed -i .orig 's/File\.exists\?/File\.exist\?/g' node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec

Where do I add this?

Run this in the terminal from the root folder of your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants