SolvedCocoaPods [1.9.2] Error during pod install JSON::ParserError - 767: unexpected token

Command

/usr/local/bin/pod install

Report

  • What did you do?
    I add Firebase into multiple target.

  • What did you expect to happen?
    Firebase pods will installed correctly

  • What happened instead?
    The response after pod install is just JSON::ParserError - 767: unexpected token at ''. But when I didn't include Firebase, installation going well

Stack

   CocoaPods : 1.9.2
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15.4 (19E287)
       Xcode :  ()
         Git : git version 2.24.1 (Apple Git-126)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

workspace 'MyMultiCare'

project 'App/App.xcodeproj'
project 'App-in/App-in.xcodeproj'

def firebase_pods
  pod 'Firebase/Core' #
  pod 'Firebase/Firestore' #
  pod 'Firebase/Messaging' #
  pod 'Firebase/RemoteConfig' #
  pod 'Firebase/Storage' #
  pod 'FirebaseFirestoreSwift'#
end

def pod_utility
  pod 'Kingfisher' #
  pod 'PDFGenerator'
end

def pod_ui
  pod 'SwiftMessages'
end

target 'App' do
  use_frameworks!
  project 'App/App.xcodeproj'
  pod 'Firebase/Core'
  pod 'Firebase/Storage'
  pod_ui
  pod_utility
end

Error

JSON::ParserError - 767: unexpected token at ''
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/json/common.rb:156:in `parse'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/json/common.rb:156:in `parse'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.2/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.2/lib/cocoapods-core/specification.rb:742:in `from_string'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.2/lib/cocoapods-core/specification.rb:716:in `from_file'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.2/lib/cocoapods-core/source.rb:186:in `specification'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver/lazy_specification.rb:37:in `specification'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver/lazy_specification.rb:29:in `subspec_by_name'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:362:in `block in specifications_for_dependency'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:362:in `map'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:362:in `specifications_for_dependency'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:165:in `search_for'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:267:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:267:in `sort_by'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:53:in `block in sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in `with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:52:in `sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:288:in `initial_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:210:in `start_resolution'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:168:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer/analyzer.rb:1065:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer/analyzer.rb:1063:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.2/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
38 Answers

โœ”๏ธAccepted Answer

Running only sudo rm -rf ~/.cocoapods/repos and then pod install was enough for my case.

Other Answers:

I had the same error code and i updated cocoapods then cleared cache with the code below and then installed pod without errors.

clear cache with this line -- sudo rm -rf ~/.cocoapods/repos

More Issues: