该问题也在Github-Cocoapods上报告了
因此,我正在测试要在项目(运行RN0.59.10)上进行Jest的工作,安装了Enzyme并运行良好,一切都很好。当我将它们合并到当前项目(在RN0.61上运行)时,解决了一些合并冲突,然后在pod install
中遇到问题。两者之间可能出了什么问题?
项目在RN0.59中一次又一次设置没有问题,只有RN0.61与podfile一起出现时,问题才会出现。需要指出的是,在集成两个分支之前,我在RN0.61上的项目可以在pod install
上正常运行。
下面是我试图解决的方法列表,但我仍然没有运气。
node_modules
+yarn.lock
+Pods
+Podfile.lock
+再次安装纱线和吊舱[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.
将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