我正在尝试在React Native应用的pod install
子目录中运行ios
。但是,我遇到了以下错误:
Kurts-MacBook-Pro-2:ios kurtpeek$ pod install
Analyzing dependencies
Fetching podspec for `CodePush` from `../node_modules/react-native-code-push`
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `SentryReactNative` from `../node_modules/react-native-sentry`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
[!] CocoaPods could not find compatible versions for pod "React/BatchedBridge":
In snapshot (Podfile.lock):
React/BatchedBridge
In Podfile:
React/BatchedBridge (from `../node_modules/react-native`)
None of your spec sources contain a spec satisfying the dependencies: `React/BatchedBridge (from `../node_modules/react-native`), React/BatchedBridge`.
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.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
[!] Automatically assigning platform `ios` with version `8.0` on target `LucyApp` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
以下是Podfile
:
target 'LucyApp' do
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'BatchedBridge',
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
# Third party deps podspec link
pod 'Intercom'
pod 'CodePush', :path => '../node_modules/react-native-code-push'
pod 'SentryReactNative', :path => '../node_modules/react-native-sentry'
end
我是否必须明确添加pod 'BatchedBridge'
?
更新
在回答Larme关于系统的问题时,以下是React.podspec
中../node_modules/react-native
的内容:
# coding: utf-8
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
version = package['version']
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
source[:commit] = `git rev-parse HEAD`.strip
else
source[:tag] = "v#{version}"
end
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
Pod::Spec.new do |s|
s.name = "React"
s.version = version
s.summary = package["description"]
s.description = <<-DESC
React Native apps are built using the React JS
framework, and render directly to native UIKit
elements using a fully asynchronous architecture.
There is no browser and no HTML. We have picked what
we think is the best set of features from these and
other technologies to build what we hope to become
the best product development framework available,
with an emphasis on iteration speed, developer
delight, continuity of technology, and absolutely
beautiful and fast products with no compromises in
quality or capability.
DESC
s.homepage = "http://facebook.github.io/react-native/"
s.license = package["license"]
s.author = "Facebook"
s.source = source
s.default_subspec = "Core"
s.requires_arc = true
s.platforms = { :ios => "8.0", :tvos => "9.2" }
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" }
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs", "PATENTS"
s.cocoapods_version = ">= 1.2.0"
s.subspec "Core" do |ss|
ss.dependency "yoga", "#{package["version"]}.React"
ss.source_files = "React/**/*.{c,h,m,mm,S,cpp}"
ss.exclude_files = "**/__tests__/*",
"IntegrationTests/*",
"React/DevSupport/*",
"React/Inspector/*",
"ReactCommon/yoga/*",
"React/Cxx*/*",
ss.ios.exclude_files = "React/**/RCTTV*.*"
ss.tvos.exclude_files = "React/Modules/RCTClipboard*",
"React/Views/RCTDatePicker*",
"React/Views/RCTPicker*",
"React/Views/RCTRefreshControl*",
"React/Views/RCTSlider*",
"React/Views/RCTSwitch*",
"React/Views/RCTWebView*"
ss.header_dir = "React"
ss.framework = "JavaScriptCore"
ss.libraries = "stdc++"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
end
s.subspec "CxxBridge" do |ss|
ss.dependency "Folly", "2016.09.26.00"
ss.dependency "React/Core"
ss.dependency "React/cxxreact"
ss.compiler_flags = folly_compiler_flags
ss.private_header_files = "React/Cxx*/*.h"
ss.source_files = "React/Cxx*/*.{h,m,mm}"
end
s.subspec "DevSupport" do |ss|
ss.dependency "React/Core"
ss.dependency "React/RCTWebSocket"
ss.source_files = "React/DevSupport/*",
"React/Inspector/*"
end
s.subspec "tvOS" do |ss|
ss.dependency "React/Core"
ss.source_files = "React/**/RCTTV*.{h, m}"
end
s.subspec "jschelpers" do |ss|
ss.dependency "Folly", "2016.09.26.00"
ss.dependency "React/PrivateDatabase"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/jschelpers/*.{cpp,h}"
ss.private_header_files = "ReactCommon/jschelpers/*.h"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
ss.framework = "JavaScriptCore"
end
s.subspec "jsinspector" do |ss|
ss.source_files = "ReactCommon/jsinspector/*.{cpp,h}"
ss.private_header_files = "ReactCommon/jsinspector/*.h"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
end
s.subspec "PrivateDatabase" do |ss|
ss.source_files = "ReactCommon/privatedata/*.{cpp,h}"
ss.private_header_files = "ReactCommon/privatedata/*.h"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
end
s.subspec "cxxreact" do |ss|
ss.dependency "React/jschelpers"
ss.dependency "React/jsinspector"
ss.dependency "boost-for-react-native", "1.63.0"
ss.dependency "Folly", "2016.09.26.00"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/cxxreact/*.{cpp,h}"
ss.exclude_files = "ReactCommon/cxxreact/SampleCxxModule.*"
ss.private_header_files = "ReactCommon/cxxreact/*.h"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Folly\"" }
end
s.subspec "ART" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/ART/**/*.{h,m}"
end
s.subspec "RCTActionSheet" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/ActionSheetIOS/*.{h,m}"
end
s.subspec "RCTAnimation" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/NativeAnimation/{Drivers/*,Nodes/*,*}.{h,m}"
ss.header_dir = "RCTAnimation"
end
s.subspec "RCTBlob" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Blob/*.{h,m,mm}"
ss.preserve_paths = "Libraries/Blob/*.js"
end
s.subspec "RCTCameraRoll" do |ss|
ss.dependency "React/Core"
ss.dependency 'React/RCTImage'
ss.source_files = "Libraries/CameraRoll/*.{h,m}"
end
s.subspec "RCTGeolocation" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Geolocation/*.{h,m}"
end
s.subspec "RCTImage" do |ss|
ss.dependency "React/Core"
ss.dependency "React/RCTNetwork"
ss.source_files = "Libraries/Image/*.{h,m}"
end
s.subspec "RCTNetwork" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Network/*.{h,m,mm}"
end
s.subspec "RCTPushNotification" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/PushNotificationIOS/*.{h,m}"
end
s.subspec "RCTSettings" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Settings/*.{h,m}"
end
s.subspec "RCTText" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Text/**/*.{h,m}"
end
s.subspec "RCTVibration" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Vibration/*.{h,m}"
end
s.subspec "RCTWebSocket" do |ss|
ss.dependency "React/Core"
ss.dependency "React/RCTBlob"
ss.dependency "React/fishhook"
ss.source_files = "Libraries/WebSocket/*.{h,m}"
end
s.subspec "fishhook" do |ss|
ss.header_dir = "fishhook"
ss.source_files = "Libraries/fishhook/*.{h,c}"
end
s.subspec "RCTLinkingIOS" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/LinkingIOS/*.{h,m}"
end
s.subspec "RCTTest" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/RCTTest/**/*.{h,m}"
ss.frameworks = "XCTest"
end
s.subspec "_ignore_me_subspec_for_linting_" do |ss|
ss.dependency "React/Core"
ss.dependency "React/CxxBridge"
end
end
确实没有子谱"BatchedBridge"
。据我所知,在我的本地BatchedBridge
中也没有提到~/node_modules
:
Kurts-MacBook-Pro-2:node_modules kurtpeek$ ls
balanced-match fs.realpath jasmine path-is-absolute
brace-expansion glob jasmine-core wrappy
concat-map inflight minimatch
exit inherits once
Kurts-MacBook-Pro-2:node_modules kurtpeek$ find . -name '*BatchedBridge*'
Kurts-MacBook-Pro-2:node_modules kurtpeek$ pwd
/Users/kurtpeek/node_modules
答案 0 :(得分:1)
根据Releases Notes of 0.54.0,它已被删除:
iOS特定删除
删除RCTBatchedBridge(816d417 {/ 3}}
使用diff。
提交@mhorowitz提交消息:
删除RCTBatchedBridge摘要:
我和几个专业人士谈过 社区用户,他们都可以删除此代码。有 几个文档修复程序将使第三方开发人员更容易 这应该会在同一时间降落。
与RCTJSCExecutor一起被埋葬。
评论人:javache
差异版本:D6880781
fbshipit-source-id:b4cb1143def6fd23a96290e478fa728adbedacd3
所以你可以回到之前的版本(0.53。?)仍然拥有它或摆脱它并从你当前的代码(以及你的 Podfile )中删除它。
答案 1 :(得分:1)
实际上,您应该运行pod repo update
,因为您的本地缓存已过时,它找不到最新版本。
答案 2 :(得分:1)
如果您最近更新到React Native 0.63.2,则应使用简单的pod update
进行修复。