CDN:trunk 相对路径:CocoaPods-version.yml存在

CDN: trunk Relative path: CocoaPods-version.yml exists

Github-Cocoapods

上也报告了问题

所以我正在测试在我的项目中使用 Jest(是 运行 RN0.59.10),安装 Enzyme 后一切正常,运行 正常。当我将它们合并到我当前的项目(在 RN0.61 上运行)时,解决了一些合并冲突,然后我在 pod install 期间遇到问题。中间可能出了什么问题?

项目在RN0.59中一次又一次设置没有问题,只有当RN0.61带有podfile时才会出现问题。需要指出的一件事是,在集成两个分支之前,我在 RN0.61 上的项目在 pod install.

上运行良好

以下是我尝试克服问题的方法列表,但不幸的是我仍然卡住了。

  1. pod 仓库更新
  2. pod 安装 --repo-update
  3. 删除 node_modules + yarn.lock + Pods + Podfile.lock + 再次安装 Yarn 和 pod 安装

登录自 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.

播客版本:1.8.4

React-Native-信息:

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 安装成功!

我决定进一步研究这个问题,以下是几个案例场景的结果。

去掉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.

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