Going through the Getting Started guide for Firebase I encountered this error ‘JSON::ParserError – 767: unexpected token at ‘ and thought to blog and share how to fix it.

I went to the Xcode project directory in the terminal and ran

pod init

Then I defined the PodFile spec

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

target 'Firebase Getting Started' do
  # Comment the next line if you don't want to use dynamic frameworks

  # Pods for Firebase Getting Started
  pod 'Firebase/Analytics'
  # Add the pods for any other Firebase products you want to use in your app
  # For example, to use Firebase Authentication and Cloud Firestore
  pod 'Firebase/Auth'
  pod 'Firebase/Firestore'


But when I ran

pod install

I encountered this error

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:

If none exists, create a ticket, with the template displayed above, on:

Be sure to first read the contributing guide for details on how to properly submit a ticket:

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...
 - [1.9.2] Error during pod install JSON::ParserError - 767: unexpected token
   https://github.com/CocoaPods/CocoaPods/issues/9814 [open] [31 comments]
   8 hours ago

 - https://github.com/CocoaPods/CocoaPods/search?q=767%3A+unexpected+token+at+%27%27&type=Issues
   https://github.com/CocoaPods/CocoaPods/issues/9777 [closed] [3 comments]
   2 weeks ago

 - Error during pod install: Encountered an unknown error (783: unexpected token at
   https://github.com/CocoaPods/CocoaPods/issues/9672 [closed] [92 comments]
   22 hours ago

and 12 more at:

[!] Automatically assigning platform `iOS` with version `13.5` on target `Firebase Getting Started` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

After checking the issues. It turns out the cocoapods repo cache on my machine somehow got corrupted. To fix the error I simply deleted the cache.

sudo rm -rf ~/.cocoapods/repos

And running pod install after that worked.


Leave a Reply

Your email address will not be published. Required fields are marked *