几天前,我将 Mac 升级到 MacOS 15 Sequoia。但今天,当我尝试在一个项目中安装 pod 时,出现了与 cocoaPods 和 ruby 相关的错误
$ npx pod-install ios
Scanning for pods...
/opt/homebrew/bin/pod: /opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/bin/pod: /opt/homebrew/opt/ruby/bin/ruby: bad interpreter: No such file or directory
/opt/homebrew/bin/pod: line 2: /opt/homebrew/Cellar/cocoapods/1.15.2_1/libexec/bin/pod: Undefined error: 0
› Attempting to install CocoaPods CLI with Gem
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
Your password might be needed to install CocoaPods CLI: https://guides.cocoapods.org/using/getting-started.html#installation
Password:
ERROR: Error installing cocoapods:
The last version of drb (>= 0) to support your Ruby & RubyGems was 2.0.6. Try installing it with `gem install drb -v 2.0.6` and then running the current command again
drb requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
› Failed to install CocoaPods CLI with Gem
我有另一个项目运行良好,我尝试删除 Pod 并重新安装。这个项目也开始失败。
我检查了react-native doctor命令,我得到了这个:
Common
✓ Node.js
✓ yarn
✓ Watchman - Used for watching changes in the filesystem when in development mode
Android
✓ JDK
✓ Android Studio - Required for building and installing your app on Android
✓ Android SDK - Required for building and installing your app on Android
✓ ANDROID_HOME
iOS
✓ Xcode - Required for building and installing your app on iOS
✖ CocoaPods - Required for installing iOS dependencies
- Version found: N/A
- Version supported: >= 1.10.0
✓ ios-deploy - Required for installing your app on a physical device with the CLI
✓ .xcode.env - File to customize Xcode environment
尝试用它解决问题,但目前不起作用。问题依然存在。
这是我的系统信息
System:
OS: macOS 15.0
CPU: (8) arm64 Apple M1
Memory: 131.61 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.8.0 - /opt/homebrew/bin/node
Yarn: 1.22.21 - /opt/homebrew/bin/yarn
npm: 10.8.2 - /opt/homebrew/bin/npm
Watchman: 2024.09.02.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK:
Platforms: DriverKit 24.0, iOS 18.0, macOS 15.0, tvOS 18.0, visionOS 2.0, watchOS 11.0
Android SDK:
API Levels: 33, 34
Build Tools: 30.0.3, 33.0.0, 33.0.1, 34.0.0
System Images: android-33 | Google APIs ARM 64 v8a, android-34 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11076708
Xcode: 16.0/16A242d - /usr/bin/xcodebuild
Languages:
Java: 17.0.12 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.1 => 0.71.1
react-native-macos: Not Found
这是我尝试手动安装 cocoapods 时得到的结果。
CocoaPods (installing with gem)(node:10050) [DEP0053] DeprecationWarning: The `util.isObject` API is deprecated. Please use `arg !== null && typeof arg === "object"` instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:10050) [DEP0049] DeprecationWarning: The `util.isFunction` API is deprecated. Please use `typeof arg === "function"` instead.
✖ CocoaPods (installing with gem)
我尝试了很多东西,但仅仅从brew中删除cocoapods对我来说就有效。
brew uninstall cocoapods