skip to Main Content

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


    1. Install 2.9.0 of react-native-gesture-handler. source: comment
    2. Install 2.14.4 of react-native-reanimated. source: comment
    3. Remove node_modules, yarn.lock ios/Podfile.lock, ios/build, ios/Pods.
    4. yarn install && yarn ios.

    I’ve also updated cocoa pods to the latest sudo gem install cocoapods.

    Login or Signup to reply.
  1. This issue happens because Ruby 3.2 removed deprecated function File.exists? (reference)

    First remove node_modules, package-lock.json

    Then install newer versions of both libraries

    npm install react-native-gesture-handler@^2.9.0
    npm install react-native-reanimated@^2.14.4
    

    Then run cd ios and pod install.

    Login or Signup to reply.
  2. This solution worked for me (running Node v18.15 and Ruby v3.3.1 and my build with Yarn v1.22.19) but I had to do all of the following:

    Upgraded these dependencies:

        "expo": "^47.0.14",
        "react-native-bootsplash": "4.3.2",
        "react-native-gesture-handler": "~2.9.0",
        "react-native-reanimated": "~3.1.0",
        "react-native-safe-area-context": "4.5.1",
        "react-native-screens": "~3.20.0",
    

    Had to dump all these files:

        yarn-lock.json
        /node_modules/
        /ios/podfile.lock
        /ios/build/
        /ios/Pods/
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search