EAS 构建给出:无效的“RNGestureHandler.podspec”文件:未定义的方法“存在?”

oro*_*ome 24 ruby cocoapods react-native-gesture-handler eas

最近,当yarn eas build我的世博项目开始失败时

[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]  #  -------------------------------------------

Run Code Online (Sandbox Code Playgroud)

我不经常在本地进行构建(在 Expo 服务器上进行远程构建效果很好),因此过去几周内可能有很多事情触发了此问题,包括从 Intel MBP 迁移到 M2 MBA,但我想知道是否有一个有人有经验的明显原因。该错误表明 podfile 使用未定义的方法存在问题。但我在网上找到的解决这个问题的建议涉及各种调整,远远超出了我所熟悉的范围。我对 Expo/EAS 的经验是一定要

brew install cocoapods fastlane
Run Code Online (Sandbox Code Playgroud)

并且不要涉及更多。理想情况下,我希望避免弄乱建议作为快速修复的特殊宝石安装。

所以问题是:这确实只是 podfile 中的一个错误(使用已弃用的方法),最终会得到修复吗?


更新:总的来说,答案似乎是“是”:这确实在受影响的软件包的更高版本中得到修复,这些软件包与 Expo 不正式兼容。如果我将它们更新到允许构建的版本,则会收到警告:

[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
Run Code Online (Sandbox Code Playgroud)

那么问题就变成了:Expo什么时候会正式支持成功构建所需的软件包版本?

Rez*_*ani 35

发生此问题的原因是 Ruby3.2删除了已弃用的函数File.exists?参考

首先删除node_modulespackage-lock.json

然后安装两个库的较新版本

npm install react-native-gesture-handler@^2.9.0
npm install react-native-reanimated@^2.14.4
Run Code Online (Sandbox Code Playgroud)

然后运行cd iospod install.


Dan*_*cki 9

  1. 安装.2.9.0react-native-gesture-handler来源:评论
  2. 安装.2.14.4react-native-reanimated来源:评论
  3. 消除node_modulesyarn.lock ios/Podfile.lockios/buildios/Pods
  4. yarn install && yarn ios

我还将可可豆荚更新到了最新版本sudo gem install cocoapods


She*_*mir 7

为这些库安装新版本:react-native-gesture-handlerreact-native-reanimated

npm install react-native-gesture-handler@^2.9.0
npm install react-native-reanimated@^2.14.4
Run Code Online (Sandbox Code Playgroud)

然后

pod install
Run Code Online (Sandbox Code Playgroud)