英文:
EAS build gives: Invalid `RNGestureHandler.podspec` file: undefined method `exists?'
问题
最近,当我运行yarn eas build
来构建我的Expo项目时,出现了以下错误:
[INSTALL_PODS] 使用Expo模块
[INSTALL_PODS] [Expo] 启用ExpoModulesCore模块的模块化头文件
...
[INSTALL_PODS] [!] 无效的`Podfile`文件:
[INSTALL_PODS] [!] 无效的`RNGestureHandler.podspec`文件: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
中使用了一个未定义的方法。但我在网上找到的解决方法牵涉到各种我不太熟悉的调整。我对Expo/EAS的经验仅限于确保运行以下命令:
brew install cocoapods fastlane
并没有更多的涉及。理想情况下,我想避免涉及到建议的快速修复中提到的特殊gem安装。
所以问题是:这只是一个Podfile
中的错误(使用了已弃用的方法),最终会被修复吗?
更新:总的来说,答案似乎是“是”的:这个问题在受影响的包的后续版本中得到了修复,但是这些包与Expo官方不兼容。如果我将它们更新到允许构建的版本,那么我会收到警告:
[RUN_EXPO_DOCTOR] [16:17:37] 一些依赖项与安装的Expo包版本不兼容:
[RUN_EXPO_DOCTOR] [16:17:37] - react-native-gesture-handler - 期望版本:~2.8.0 - 实际安装版本:2.9.0
[RUN_EXPO_DOCTOR] [16:17:37] - react-native-reanimated - 期望版本:~2.12.0 - 实际安装版本:2.14.4
所以问题变成了:Expo何时会官方支持成功构建所需的包版本?
英文:
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?
答案1
得分: 28
这个问题发生是因为 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
。
英文:
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
.
答案2
得分: 8
- 安装
react-native-gesture-handler
的版本2.9.0
。来源: comment - 安装
react-native-reanimated
的版本2.14.4
。来源: comment - 移除
node_modules
、yarn.lock
、ios/Podfile.lock
、ios/build
、ios/Pods
。 - 运行
yarn install && yarn ios
。
我还更新了 CocoaPods 到最新版本,使用 sudo gem install cocoapods
。
英文:
- Install
2.9.0
ofreact-native-gesture-handler
. source: comment - Install
2.14.4
ofreact-native-reanimated
. source: comment - Remove
node_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
.
答案3
得分: 5
安装这些库的新版本:react-native-gesture-handler 和 react-native-reanimated。
npm install react-native-gesture-handler@^2.9.0
npm install react-native-reanimated@^2.14.4
然后执行:
pod install
英文:
install the new version for these libraries: react-native-gesture-handler & react-native-reanimated
npm install react-native-gesture-handler@^2.9.0
npm install react-native-reanimated@^2.14.4
then
pod install
答案4
得分: 4
此问题已在 GitHub 上的 expo 存储库 上报告。
建议的修复方法是 升级到 expo@47.0.13。
英文:
Ruby 3.2.0 removed File.exists?
.
This issue was reported on the expo repo on GitHub.
The recommended fix is to upgrade to expo@47.0.13.
答案5
得分: 1
此解决方案适用于我(运行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/
英文:
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/
答案6
得分: 0
移除 React Native Gesture Handler 的 ^
版本约束:
然后:
rm -rf node_modules
yarn install
cd ios
pod install
之后,你的 Pod 应该可以正常工作。
对我来说也运行正常
英文:
Remove ^
from package dot json for react native gesture handler
Then:
rm -rf node_modules
yarn install
cd ios
pod install
And after that your pod will work fine.
It woks fine for me
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论