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

问题描述 投票:0回答:6

最近,当我

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

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

brew install cocoapods fastlane

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

所以问题是:这确实只是 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

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

ruby cocoapods react-native-gesture-handler eas
6个回答
27
投票

发生此问题是因为 Ruby

3.2
删除了已弃用的函数
File.exists?
参考

首先删除

node_modules
package-lock.json

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

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

然后运行

cd ios
pod install


8
投票
  1. 安装
    2.9.0
    react-native-gesture-handler
    。来源:评论
  2. 安装
    2.14.4
    react-native-reanimated
    。来源:评论
  3. 删除
    node_modules
    yarn.lock
    ios/Podfile.lock
    ios/build
    ios/Pods
  4. yarn install && yarn ios
    .

我还将可可豆荚更新到了最新的

sudo gem install cocoapods


5
投票

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

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

然后

pod install

4
投票

Ruby 3.2.0 已删除

File.exists?

此问题已在 GitHub 上的 expo 存储库 上报告。

建议的修复方法是 升级到 [电子邮件受保护]


0
投票

这个解决方案对我有用(运行 Node

v18.15
和 Ruby
v3.3.1
以及我使用 Yarn
v1.22.19
的构建),但我必须执行以下所有操作:

升级了这些依赖项:

    "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",

必须转储所有这些文件:

    yarn-lock.json
    /node_modules/
    /ios/podfile.lock
    /ios/build/
    /ios/Pods/

0
投票

从包 dot json 中删除

^
以响应本机手势处理程序

然后:

rm -rf node_modules
yarn install 
cd ios
pod install 

之后你的 Pod 就会正常工作了。

这对我来说很好:)

© www.soinside.com 2019 - 2024. All rights reserved.