DEV Community

Cover image for [!] CocoaPods could not find compatible versions for pod
Matt Ruiz
Matt Ruiz

Posted on

1

[!] CocoaPods could not find compatible versions for pod

Hola hola,

When working with a bare CLI React Native app, I often run into issues during the pod install command.

Currently, I’m getting this CocoaPods could not find compatible versions for pod with: when working on the React Native version of Amplinks.

Here is the error that I’m getting. Yours could be for non-firebase packages — I’ve had it happen with Sentry/Stripe/etc.

[!] CocoaPods could not find compatible versions for pod "Firebase/Analytics":
  In snapshot (Podfile.lock):
    Firebase/Analytics (= 11.7.0)

  In Podfile:
    RNFBAnalytics (from `../node_modules/@react-native-firebase/analytics`) was resolved to 21.6.1, which depends on
      Firebase/Analytics (= 11.5.0)
Enter fullscreen mode Exit fullscreen mode

The CLI then gives us the following message highlighting potential issues and their fix.

You have either:

  • out-of-date source repos which you can update with pod repo update or with pod install —-repo-update.
  • changed the constraints of dependency Firebase/Analytics inside your development pod RNFBAnalytics. You should run pod update Firebase/Analytics to apply changes you’ve made.

How to fix CocoaPods could not find compatible versions for pod?

Option 1: Run the command as it says

For me, the pod install — repo-update command somtimes work’s by itself. Note: you will have to run cd ios before running any pod ... command since it will look for a local ./Podfile . Here is an article from Gant at Infinite Red labeled Beginner’s Guide to Using CocoaPods with React Native.

Option 2: Remove some extra files/cache/etc

Other times, I have to:

  1. Delete derived data for the app I’m currently working on: StackOverflow
  2. run pod deintegrate to remove the bad Pods: StackOverflow
  3. Remove node_modules in root of React Native project
  4. Remove ios/Pods , ios/build , and ios/Podfile.lock (maybe even ./yarn.lock or package-lock.json

Summary

The React Native ←→ Xcode environment can be really taxing and can take up hours of your day. I call them config days and they can really dampen momentum.

I would recommend that you take extra time:

  1. To read, and then re-read, the error messages every time. Don’t try to copy and past into Google/ChatGPT right away — you’ve got to know what to look for.
  2. To read through documentation for these base level cli commands and the related environments - try and make sense of those StackOverflow links I shared. They might not make sense now but they will eventually.
  3. Learn about Pods and how they they mirror node_modules behavior but on a native iOS/Xcode/Swift/Objective C level — basic understanding will take you far.

Good luck — hope this was helpful!

Please give a follow on Twitter if you’re in the space!

— Matt

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Sentry growth stunted Image

If you are wasting time trying to track down the cause of a crash, it’s time for a better solution. Get your crash rates to zero (or close to zero as possible) with less time and effort.

Try Sentry for more visibility into crashes, better workflow tools, and customizable alerts and reporting.

Switch Tools