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

时间:2019-12-19 08:12:39

标签: react-native cocoapods yarn podfile

问题也在developper.android web site

上报告了

因此,我正在测试在项目(运行RN0.59.10)上的Jest上工作,安装了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 +重新安装纱线并进行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.

Pod版本:1.8.4

React-Native-info:

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.

1 个答案:

答案 0 :(得分:0)

TLDR;

source 'https://cdn.cocoapods.org/'附加到Podfile(在执行目标“ projectName”之前)


最后,找到了根本原因并找到了解决方法! 原因是,我的podfile中有一个privateRepo,它覆盖了从Cocoapods获取podspec的默认来源。错误示例如下

# 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'

target 'project' do
  # Comment the next line if you don't want to use dynamic frameworks
  # use_frameworks!
.....
....
...
..
.
end