✖ Installing CocoaPods dependencies (this may take a few minutes) ✖ Installing CocoaPods dependencies (this may take a few minutes) error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template. Please try again manually: "cd ./MyTestApp/ios && pod install". CocoaPods documentation: https://cocoapods.org/
pod install 按照失败的原因可能就比较多了,我先查看了一下pod –version得到我的pod版本好是1.8.4
然后我就进入项目的MyTestApp/ios目录,做过ios都知道这个目录下面就是一个oc代码的一个原生ios项目的结构,有.xcodeproj 还有一个Podfile文件。 因为我们pod install还没成功,所以还没有.xcworkspace文件。 我尝试直接在这个ios项目的目录下面直接执行 pod install,得到报错如下:
target 'MyTestApp' do config = use_native_modules!
use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods :hermes_enabled => false )
target 'MyTestAppTests' do inherit! :complete # Pods for testing end
# Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. use_flipper!()
post_install do |installer| react_native_post_install(installer) end end
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours: https://github.com/CocoaPods/CocoaPods/search?q=%5BXcodeproj%5D+Unknown+object+version.&type=Issues
If none exists, create a ticket, with the template displayed above, on: https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket: https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods... - [Xcodeproj] Unknown object version. Help Please https://github.com/CocoaPods/CocoaPods/issues/10604 [open] [2 comments] a week ago
➜ ios gem uninstall xcodeproj Gem 'xcodeproj' is not installed ➜ ios gem install xcodeproj Fetching xcodeproj-1.19.0.gem Fetching nanaimo-0.3.0.gem ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory. ➜ ios gem install xcodeproj ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
➜ ios pod install Analyzing dependencies Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec` Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec` Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec` [!] `OpenSSL-Universal` requires CocoaPods version `>= 1.9`, which is not satisfied by your current version, `1.8.4`.
那我就只能把pod 升级了。注意,pod 升级不是 pod update 这个是更新pod依赖库的版本好。我们现在需要更新Cocoapods这个软件本身的版本。 我之前是用brew安装的Cocoapods, 那为了避免冲突,我还是用brew去升级这个Cocoapods软件。
1
brew upgrade cocoapods
更新Cocoapods版本到v1.10.1了,软件更新成功,使用 pod --version查看版本直接找不到pod这个命令zsh: command not found: pod。这种情况一般是软件引用链接没关联到zsh导致,看下面执行升级cocoapods命令时的报错:
1 2 3 4 5 6 7 8 9 10 11 12
Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/xcodeproj Target /usr/local/bin/xcodeproj already exists. You may want to remove it: rm '/usr/local/bin/xcodeproj'
To force the link and overwrite all conflicting files: brew link --overwrite cocoapods
To list all files that would be deleted: brew link --overwrite --dry-run cocoapods
有文件冲突,和文件引用链接 没关联,按照报错提升执行,先删除冲突文件。
1
rm '/usr/local/bin/xcodeproj'
然后强制brew link关联软件引用路径。
1
brew link --overwrite cocoapods
pod 版本更新成功看下图:
这个时候回到React Native项目的ios目录执行 pod install pod 安装成功,如下图: