CDN:trunk 相对路径:CocoaPods-version.yml 存在
Posted
技术标签:
【中文标题】CDN:trunk 相对路径:CocoaPods-version.yml 存在【英文标题】:CDN: trunk Relative path: CocoaPods-version.yml exists 【发布时间】:2020-04-11 19:24:15 【问题描述】:问题也报告在Github-Cocoapods
所以我正在测试在我的项目中使用 Jest(运行 RN0.59.10),安装 Enzyme 并且运行良好,一切都很好。当我将它们合并到我当前的项目(在 RN0.61 上运行)时,解决了一些合并冲突,然后我在 pod install
期间遇到问题。中间可能出了什么问题?
项目在 RN0.59 中反复设置没有问题,只有在 RN0.61 带有 podfile 时才会出现问题。需要指出的一点是,在集成这两个分支之前,我在 RN0.61 上的项目与 pod install
可以正常工作。
以下是我尝试解决问题的方法列表,但运气不好,我仍然卡住了。
-
pod 存储库更新
pod install --repo-update
删除
node_modules
+ yarn.lock
+ Pods
+ Podfile.lock
+ Yarn install 和 pod install 再次
来自pod install --verbose
的日志
Resolving dependencies of `Podfile`
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
[!] Unable to find a specification for `Firebase/Core (~> 6.9.0)`
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
我的 Podfile 的一部分(给我带来了问题):
# Required by RNFirebase
pod 'Firebase/Core', '~> 6.9.0'
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
pod 'Fabric', '~> 1.10.2'
pod 'Crashlytics', '~> 3.14.0'
当我删除上面的 4 行时会发生什么? (这是错误的,我怀疑我的本地有问题)
[!] Unable to find a specification for `boost-for-react-native (= 1.63.0)` depended upon by `React-cxxreact`
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
Pod 版本:1.8.4
反应原生信息:
System:
OS: macOS Mojave 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz
Memory: 65.95 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.10.0 - /usr/local/bin/node
Yarn: 1.19.0 - /usr/local/bin/yarn
npm: 6.12.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
android SDK:
API Levels: 23, 28, 29
Build Tools: 28.0.3, 29.0.2
System Images: android-24 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom_64
Android NDK: 19.2.5345600
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.0 => 0.61.0
npmGlobalPackages:
react-native-cli: 2.0.1
更新:
我实际上在安装过程中删除了 Podfile.lock。当我恢复到上一个成功状态(podfile.lock 和 yarn.lock 位于我的目录中)时,pod install 成功!
我决定进一步挖掘这个问题,这里是一些案例场景的结果。
删除podfile.lock,显示如下:
[!] Unable to find a specification for `Firebase/Core (~> 6.9.0)`
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
去掉yarn.lock,显示如下:
[!] CocoaPods could not find compatible versions for pod "FBSDKCoreKit":
In snapshot (Podfile.lock):
FBSDKCoreKit (= 5.7.0, ~> 5.0, ~> 5.5)
In Podfile:
react-native-fbsdk (from `../node_modules/react-native-fbsdk`) was resolved to 1.1.1, which depends on
react-native-fbsdk/Core (= 1.1.1) was resolved to 1.1.1, which depends on
FBSDKCoreKit (= 5.8)
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* changed the constraints of dependency `FBSDKCoreKit` inside your development pod `react-native-fbsdk`.
You should run `pod update FBSDKCoreKit` to apply changes you've made.
去掉两个yarn.lock + podfile.lock,显示如下:
[!] Unable to find a specification for `Firebase/Core (~> 6.9.0)`
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
【问题讨论】:
试试pod install --repo-update
@PaulBeusterien 我已经尝试了提到的命令,结果我得到了You have either: * mistyped the name or version. * not added the source repo that hosts the Podspec to your Podfile.
@PaulBeusterien 我已经用更新部分作为标题更新了帖子。我在那里提供了更多发现。
【参考方案1】:
TLDR;
将source 'https://cdn.cocoapods.org/'
附加到 Podfile(在目标 'projectName' 之前)
终于找到了根本原因并找到了解决方案! 原因是,我的 podfile 中有一个 privateRepo,它覆盖了从 Cocoapods 获取 podspecs 的默认来源。错误示例如下
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
source 'https://github.com/privateRepo/Specs.git'
target 'project' do
# Comment the next line if you don't want to use dynamic frameworks
# use_frameworks!
.....
....
...
..
.
end
因此,指向Cocoapods' CDN 的简单解决方案将解决问题。
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
source 'https://github.com/privateRepo/Specs.git'
# Pointing back the source to cocoapod's CDN for retrieving specs.
# Was overwritten by privateRepo/Specs.git on earlier lines
source 'https://cdn.cocoapods.org/'
target 'project' do
# Comment the next line if you don't want to use dynamic frameworks
# use_frameworks!
.....
....
...
..
.
end
【讨论】:
两个 sn-ps 是相同的,你没有在第二个中应用修复 @TommyLeong 第二个 sn-p,你没有应用修复 您好@thofiq,抱歉并感谢您的指出。我已经用修复更新了我的 sn-p。希望它有助于解决您的查询:)以上是关于CDN:trunk 相对路径:CocoaPods-version.yml 存在的主要内容,如果未能解决你的问题,请参考以下文章