问题:
我在 macOS 上的 Flutter 项目中安装 CocoaPods for Firebase 时遇到问题。 当我运行
pod install
时,我收到此错误:
rovshenhojayev@Rovshens-MacBook-Air ios % pod install
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/bin/pod install
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
CocoaPods : 1.15.2
Ruby : ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin23]
RubyGems : 3.3.3
Host : macOS 15.0.1 (24A348)
Xcode : 16.0 (16A242d)
Git : git version 2.39.5 (Apple Git-154)
Ruby lib dir : /Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
### Plugins
cocoapods-deintegrate : 1.0.5
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.1
cocoapods-trunk : 1.6.0
cocoapods-try : 1.2.0
### Podfile
ruby
# Uncomment this line to define a global platform for your project
platform :ios, '13.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
### Error
JSON::ParserError - Failed to parse JSON at file: '/Users/rovshenhojayev/.cocoapods/repos/trunk/Specs/c/8/7/gRPC-C++/1.67.0/gRPC-C++.podspec.json'.
unexpected token at '"src/core/lib/'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification/json.rb:66:in `rescue in from_json'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification.rb:759:in `from_string'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification.rb:733:in `from_file'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/source.rb:188:in `specification'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification/set.rb:58:in `block in specification_name'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification/set.rb:56:in `each'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification/set.rb:56:in `specification_name'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/cdn_source.rb:216:in `search'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/source/aggregate.rb:83:in `block in search'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/source/aggregate.rb:83:in `select'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/source/aggregate.rb:83:in `search'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:416:in `create_set_from_sources'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:385:in `find_cached_set'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:360:in `specifications_for_dependency'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:165:in `search_for'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:267:in `each'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:267:in `sort_by'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:267:in `sort_by!'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:60:in `block in sort_dependencies'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:744:in `require_nested_dependencies_for'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:727:in `activate_new_spec'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/resolver.rb:94:in `resolve'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:1082:in `block in resolve_dependencies'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:1080:in `resolve_dependencies'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:125:in `analyze'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:422:in `analyze'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:162:in `install!'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:in `run'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in `run'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/bin/pod:55:in `<top (required)>'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/bin/pod:25:in `load'
/Users/rovshenhojayev/.rvm/rubies/ruby-3.1.0/bin/pod:25:in `<main>'
/Users/rovshenhojayev/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `eval'
/Users/rovshenhojayev/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in `<main>'
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=Failed+to+parse+JSON+at+file%3A+%27%2FUsers%2Frovshenhojayev%2F.cocoapods%2Frepos%2Ftrunk%2FSpecs%2Fc%2F8%2F7%2FgRPC-C%2B%2B%2F1.67.0%2FgRPC-C%2B%2B.podspec.json%27.%0A%0Aunexpected+token+at+%27%22src%2Fcore%2Flib%2F%27&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
Found no similar issues. To create a new issue, please visit:
https://github.com/cocoapods/cocoapods/issues/new
环境:
macOS:版本 15.0.1
颤动:3.24.3
Xcode:16.0
CocoaPods:1.15.2
尝试过:
sudo gem install cocoapods
pod repo update
+ pod install
仍然面临同样的问题。有什么建议吗?
尝试将您的软件包降级为:
firebase_auth: ^4.20.0 # [https://pub.dev/packages/firebase_auth][1]
firebase_core: ^2.32.0 # [https://pub.dev/packages/firebase_core][1]
不用担心,今天就租一个营地。 我痛苦了几个小时,然后仍然遇到了这个:
[https://github.com/firebase/firebase-ios-sdk/issues/13650][1]
[https://github.com/firebase/firebase-ios-sdk/issues/13761][1]