Recently, when I yarn eas build
my expo project I have started failing with
[INSTALL_PODS] Using Expo modules
[INSTALL_PODS] [Expo] Enabling modular headers for pod ExpoModulesCore
...
[INSTALL_PODS] [!] Invalid `Podfile` file:
[INSTALL_PODS] [!] Invalid `RNGestureHandler.podspec` file: undefined method `exists?' for File:Class.
...
[INSTALL_PODS] # -------------------------------------------
[INSTALL_PODS] #
[INSTALL_PODS] > isUserApp = File.exists?(File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json"))
[INSTALL_PODS] # if isUserApp
[INSTALL_PODS] # -------------------------------------------
I don’t build locally often (remote builds on the Expo servers do fine) so any number of things might have triggered this over the past several weeks, including a migration from an Intel MBP to an M2 MBA, but I wonder if there’s an obvious reason that someone has experience with. The error suggests there’s something wrong with the podfile’s use of an undefined method. But the suggestions for addressing this I’ve found online involve all kinds of tweaking that are way beyond what I’m familiar with. My experience with Expo/EAS just been to be sure to
brew install cocoapods fastlane
and don’t involve much more than that. Ideally I’d like to avoid messing with special gem installations of the sort suggested as quick fixes.
So the question is: is this indeed just a bug in a podfile (use of a deprecated method) that will eventually get fixed?
UPDATE: Broadly it seems that the answer is "yes": this does get fixed in later versions of the affected packages, but those packages are not officially compatible with Expo. If I update them to versions that allow building, then I get warnings:
[RUN_EXPO_DOCTOR] [16:17:37] Some dependencies are incompatible with the installed expo package version:
[RUN_EXPO_DOCTOR] [16:17:37] - react-native-gesture-handler - expected version: ~2.8.0 - actual version installed: 2.9.0
[RUN_EXPO_DOCTOR] [16:17:37] - react-native-reanimated - expected version: ~2.12.0 - actual version installed: 2.14.4
so the question becomes: when will Expo officially support package versions required to successfully build?
4
Answers
Ruby 3.2.0 removed
File.exists?
.This issue was reported on the expo repo on GitHub.
The recommended fix is to upgrade to [email protected].
2.9.0
ofreact-native-gesture-handler
. source: comment2.14.4
ofreact-native-reanimated
. source: commentnode_modules
,yarn.lock
ios/Podfile.lock
,ios/build
,ios/Pods
.yarn install && yarn ios
.I’ve also updated cocoa pods to the latest
sudo gem install cocoapods
.This issue happens because Ruby
3.2
removed deprecated functionFile.exists?
(reference)First remove
node_modules
,package-lock.json
Then install newer versions of both libraries
Then run
cd ios
andpod install
.This solution worked for me (running Node
v18.15
and Rubyv3.3.1
and my build with Yarnv1.22.19
) but I had to do all of the following:Upgraded these dependencies:
Had to dump all these files: