1

I have an error when initializing a project for React Native. Macbook M1, I've already tried installing through brew and clearing the cache. But I don't understand what the error is, why json file doesn't read or it's not that error.

I've already reinstalled macOS, rm -rf ~/.cocoapods/repos/trunk/ and other things, reinstalled - nothing helps!

✖ Installing CocoaPods dependencies (this may take a few minutes)
error Framework build type is static library
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

Error

JSON::ParserError - Failed to parse JSON at file: '/Users/mykytakhaliavkin/.cocoapods/repos/trunk/Specs/a/e/a/Flipper/0.232.0/Flipper.podspec.json'.

unexpected token at ''
/Users/mykytakhaliavkin/RN6/vendor/bundle/ruby/2.6.0/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/json.rb:66:in `rescue in from_json'

6 Answers 6

1

I'm experiencing the same issue, it seems to be an issue other people are experiencing as well - https://github.com/CocoaPods/CocoaPods/issues/12115

The only 2 temporary solutions I found are:

  1. Copy manually the podspec files that are empty (e.g. https://cdn.cocoapods.org/Specs/a/e/a/Flipper/0.232.0/Flipper.podspec.json) to the corresponding location (e.g. ~/.cocoapods/repos/trunk/Specs/a/e/a/Flipper/0.232.0/Flipper.podspec.json) over the empty one.

or

  1. Change the line in Podfile specifying the source from source 'https://cdn.cocoapods.org/' to source 'https://github.com/CocoaPods/Specs.git' (or add it at the top if missing). This way pod install takes longer, but at least it works.
Sign up to request clarification or add additional context in comments.

1 Comment

I am using Flutter, but do not see any mention of source 'cdn.cocoapods...' anywhere in the project source files. Any tips where to set it? :)
1

I had similar issue and Error was raised as JSON::ParserError - Failed to parse JSON at file: '/.cocoapods/repos/trunk/Specs/0/3/5/Firebase/10.16.0/Firebase.podspec.json'

I checked that the JSON was empty at 0 bytes.

The solution was to download the original json file from https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/3/5/Firebase/10.16.0/Firebase.podspec.json to replace the file in my mac.

Thereafter pod install worked out.

Hence, in your case you might also try to replace Flipper.podspec.json file with the original file from the repository and try again with pod install. See if it helps?

Comments

1

I had the same issue with latest cocoapods(1.14.2) and was able to resolve it by changing my IP to USA ip via VPN. For mac users try "Urban VPN Desktop".

Comments

0

You need change network. Connect to VPN after run

pod install

Comments

0

I had the same issue installing the FirebaseAuth and FirebaseFirestore PODS. The solution for me was to rename the file mentioned in the error (FirebaseAuth.podspec.json and others BoringSSL also had a JSON file that was corrupt) and then run POD install again.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
-1

I found the solution, it was problem with ruby version.
See: Solve Mac ruby issues in React native installations

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.