Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pod install ... CocoaPods could not find compatible versions for pod "Stripe": #1116

Closed
russmenum opened this issue Sep 2, 2022 · 44 comments
Labels
reproduce Try and reproduce the issue

Comments

@russmenum
Copy link

Describe the bug
A clear and concise description of what the bug is.
I am trying to add @stripe/stripe-react-native to a project npm install @stripe/stripe-react-native seems to run, but when I try and do pod install I get

[!] CocoaPods could not find compatible versions for pod "Stripe":
  In Podfile:
    stripe-react-native (from `../node_modules/@stripe/stripe-react-native`) was resolved to 0.18.1, which depends on
      Stripe (~> 22.7.0)

None of your spec sources contain a spec satisfying the dependency: `Stripe (~> 22.7.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

To Reproduce
Steps to reproduce the behavior:

  1. Make a fresh app, I used npx create-react-native-app
  2. npm install @stripe/stripe-react-native
  3. cd ios, and try and run pod install
  4. See error

Expected behavior
I would expect the pod install to complete and resolve the pods

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • POD ERROR IS NOT APPLICABLE

Smartphone (please complete the following information):

  • POD ERROR IS NOT APPLICABLE

Additional context
Add any other context about the problem here.

While walking over an old project, at this point for all intents this is a new app as of this week, REDUX is the only other thing I have installed so far. The error is clearly wanting Stripe (~> 22.7.0) but I am not seeing any manual iOS links referenced in the README

@Mahdi-Farahani
Copy link

same issue

@nicolasdevienne
Copy link

Hi @russmenum, maybe you can delete ios/Podfile.lock before pod install ?

@russmenum
Copy link
Author

Hi @russmenum, maybe you can delete ios/Podfile.lock before pod install ?

Tried @nicolasdevienne , but deleting ios/Podfile.lock still resulted in the error

None of your spec sources contain a spec satisfying the dependency: `Stripe (~> 22.7.0)`.

Is there a way to manually add this co-dependency the libray seems to fail too?

@nicolasdevienne
Copy link

Hi @russmenum, try delete ios/Podfile.lock file and Pods/ directory and execute pod install --repo-update

@russmenum
Copy link
Author

Ok that did let pod install run, is there any reason you would not want to update that list? This is the first time I have ever run into the repo list not having the ver.

I know the error said that, but this is running commands I am not fully familiar with just to clear an error... Google implies it is just a list of repos? But pods are finicky

@charliecruzan-stripe
Copy link
Collaborator

@russmenum are you sure that you were able to reproduce this error with a blank project & the steps listed above? AKA:

Make a fresh app, I used npx create-react-native-app
npm install @stripe/stripe-react-native
cd ios, and try and run pod install
See error

Usually this error happens when you have an earlier version of the Stripe pod already installed, and then add (or update) a JS dependency that then uses a newer version, and you need to update the Pods to pull in the newer version. But if you were able to trigger this error after installing in just the basic react native init app, then maybe there's something else going on (although I'm not sure what). FWIW I was not able to reproduce with those steps on my machine.

@charliecruzan-stripe charliecruzan-stripe added the reproduce Try and reproduce the issue label Sep 12, 2022
@fdelacruzsoto
Copy link

@charliecruzan-stripe looks like the issue only happens when running pod install on arm arch, I tried with the intel arch it's installing the pods.

@russmenum
Copy link
Author

are you sure that you were able to reproduce this error with a blank project & the steps listed above? AKA:

@charliecruzan-stripe yes, I made a fresh project, and have copied no JSON or node over. Am copping files like app.js and then resolving dependencies and undefined one at a time, but those are the RN app JS nothing to do with PODS or libraries.

The old app JS was using tipsi-stripe but that is an entirely different repo and project, it has never been npm install on this one.

@charliecruzan-stripe looks like the issue only happens when running pod install on arm arch, I tried with the intel arch it's installing the pods.

FYI, I am doing this rebuild on an iMac 3 GHz 6-Core Intel Core i5; but I did do the repo start and npx create-react-native-app on an ARM M1 Mac-Mini. But how would the INIT carry over in such a case if it is the source? The npm install @stripe/stripe-react-native step and onward was done on an intel Mac

@charliecruzan-stripe
Copy link
Collaborator

The old app JS was using tipsi-stripe

That's the reason. NPM modules can declare dependencies on pods, so when you resolved that dependency, it added an older version of stripe-ios to your project. In the future, make sure to include all steps in the "steps to reproduce the error" section

As stated earlier, this is a common error message when attempting to update an older pod, and following the messages suggestions should resolve it :)

@russmenum
Copy link
Author

The old app JS was using tipsi-stripe

That's the reason. NPM modules can declare dependencies on pods, so when you resolved that dependency, it added an older version of stripe-ios to your project. In the future, make sure to include all steps in the "steps to reproduce the error" section

As stated earlier, this is a common error message when attempting to update an older pod, and following the messages suggestions should resolve it :)

Respectfully I did not resolve that dependency. I never installed tipsi-stripe

As stated that is ANOTHER PROJECT, not this one. The only missing step is the error tipsi-stripeis undefined. So I changed that line of JS code and npm install @stripe/stripe-react-native

//import stripe from "tipsi-stripe"; //no longer maintained, replace with @stripe/stripe-react-native
import { initStripe } from '@stripe/stripe-react-native';

@charliecruzan-stripe are you claiming what happens on another project and repo affects building an app using @stripe/stripe-react-native and caused this pod install error

Again never installed tipsi-stripe on this project. Only @stripe/stripe-react-native. I agree if I was in that old project, but will that really creep over to fresh projects and new repos?

@charliecruzan-stripe
Copy link
Collaborator

@russmenum I think it would be very helpful for you to initialize a git repository with this react native sample project you created so that I can clone it and dig in more.

No, that shouldn't creep into fresh projects but it's not totally clear to me what exactly was brought over from your old project, and what wasn't

@NatMuel
Copy link

NatMuel commented Sep 13, 2022

@charliecruzan-stripe Same here. I want to update @stripe/stripe-react-native@^0.4.0 to latest. When running pod install I got this error:

[!] CocoaPods could not find compatible versions for pod "Stripe":
  In snapshot (Podfile.lock):
    Stripe (= 21.12.0, ~> 21.12.0)

  In Podfile:
    stripe-react-native (from `../node_modules/@stripe/stripe-react-native`) was resolved to 0.18.1, which depends on
      Stripe (~> 22.7.0)

After running yarn upgrade stripe --latest, yarn upgrade @stripe/stripe-react-native --latest and running pod install and

delete ios/Podfile.lock file and Pods/ directory and execute pod install --repo-update

I get:

[!] CocoaPods could not find compatible versions for pod "stripe-react-native":
  In Podfile:
    stripe-react-native (from `../node_modules/@stripe/stripe-react-native`)

Specs satisfying the `stripe-react-native (from `../node_modules/@stripe/stripe-react-native`)` dependency were found, but they required a higher minimum deployment target.

Any suggestions how to solve this?

@russmenum
Copy link
Author

@russmenum I think it would be very helpful for you to initialize a git repository with this react native sample project you created so that I can clone it and dig in more.

No, that shouldn't creep into fresh projects but it's not totally clear to me what exactly was brought over from your old project, and what wasn't

@charliecruzan-stripe at the point I encountered my error the only thing I brought over was

App.js

or

import React, {useContext} from "react";
import {Platform} from "react-native";

//import stripe from "tipsi-stripe"; //no longer maintained, replace with @stripe/stripe-react-native
import { initStripe } from '@stripe/stripe-react-native';

import { PersistGate } from "redux-persist/integration/react";
import { Provider } from "react-redux";
import { store, persistor } from "./redux/store";
import MAINAPP from "./MAINAPP";
import { Text, TextInput, ActivityIndicator, AsyncStorage } from "react-native";
import { colors } from "./constants/restaurantColors";


import { ModalProvider } from "./contextAPIs/ModalContext";
import { RestaurantProvider } from "./contextAPIs/RestaurantContext";
import { UserProvider } from "./contextAPIs/UserContext";

import {devicePushTokenAsync, requestNotificationPermission} from "./util/notifications";

import Constants from 'expo-constants';
import * as Notifications from 'expo-notifications';
import { useState, useEffect, useRef } from 'react';
import { View, Button } from 'react-native';

Notifications.setNotificationHandler({
  handleNotification: async () => ({
    shouldShowAlert: true,
    shouldPlaySound: true,
    shouldSetBadge: true,
  }),
});




const TESTMODE = false;

if (__DEV__) {
  import('./ReactotronConfig').then(() => console.log('Reactotron Configured'))
}

// stripe.setOptions({
//   publishableKey: "SANITIZED",
//   merchantId: "SANITIZED",
//   androidPayMode: TESTMODE ? 'test' : 'production', 
// });
useEffect(() => { //SEE: https://github.com/stripe/stripe-react-native
    const publishableKey = "SANITIZED"
  
  
    initStripe({
      publishableKey: publishableKey,
      merchantIdentifier: "SANITIZED",
      //urlScheme="your-url-scheme",
    });
  }, []);

function App() {
  const [expoPushToken, setExpoPushToken] = useState('');
  const [notification, setNotification] = useState(false);
  const notificationListener = useRef();
  const responseListener = useRef();

  useEffect(() => {
    requestNotificationPermission()
  }, []);

  Text.defaultProps = Text.defaultProps || {};
  Text.defaultProps.allowFontScaling = false;
  TextInput.defaultProps = TextInput.defaultProps || {};
  TextInput.defaultProps.allowFontScaling = false;

  return (
    <>
    <ModalProvider>
    <RestaurantProvider>
    <UserProvider>

    <Provider store={store}>
      <PersistGate
        loading={<ActivityIndicator color={colors.primaryDark} />}
        persistor={persistor}
      >
        {TESTMODE 
          ? (<Text style={Platform.OS === 'ios' ? [styles.AndroidTestMode, styles.iOSTestMode] : [styles.AndroidTestMode]}>TEST MODE</Text>)
          : null
        }
        <MAINAPP />
      </PersistGate>
    </Provider>
    
    </UserProvider>
    </RestaurantProvider>
    </ModalProvider>
    </>
  );
}

export default App;

const styles = {
  AndroidTestMode: {
    backgroundColor:"yellow",
    color:"red",
  },
  iOSTestMode: {
    paddingTop: 45,
  },
}

All I did was copy the old JS over to start resolving/updating to current libraries. This is a clean restart to get up to date. For obvious reasons sanitized the keys, but otherwise this is the code added beyond the command line steps originally posted.

As you can tell from the code have since copied more over and added redux, but at the point I hit the stripe pod install error, this was it beyond what npx create-react-native-app made.

@charliecruzan-stripe
Copy link
Collaborator

Please provide a link to a repo that I can clone to reproduce the error, the JS code wouldn't cause the pod issue

@nicolasdevienne
Copy link

Hi @russmenum, have you the minimum requirement of iOS = 12.0 in your Podfile and your Xcode project ?

@vishaldhanotiya
Copy link

vishaldhanotiya commented Sep 16, 2022

I have similar type of issue. I follow these 2 step to resolve my issue.

First Issue

[!] CocoaPods could not find compatible versions for pod "stripe-react-native": In Podfile: stripe-react-native (from ../node_modules/@stripe/stripe-react-native`)

Specs satisfying the stripe-react-native (from ../node_modules/@stripe/stripe-react-native) dependency were found, but they required a higher minimum deployment target.`

Solution 1:- Change the ios version the in pod file from 11 to 12

Second Issue (I faced this issue because of the Mac M1 chip)

image

Solution 2:- Use the following command which help me to resolve this issue

sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc

Found solution on this stack answer

https://stackoverflow.com/a/73651994/9158543

@Mahdi-Farahani
Copy link

Mahdi-Farahani commented Sep 20, 2022

Please provide a link to a repo that I can clone to reproduce the error, the JS code wouldn't cause the pod issue
Screen Shot 2022-09-20 at 08 37 13

still i couldn't fix this issue

CocoaPods could not find compatible versions for pod "stripe-react-native":

OS:MAC M1
platform :ios, '11.0'
"react-native": "0.64.2",
"@stripe/stripe-react-native": "^0.18.1",

@russmenum
Copy link
Author

Please provide a link to a repo that I can clone to reproduce the error, the JS code wouldn't cause the pod issue
Screen Shot 2022-09-20 at 08 37 13

still i couldn't fix this issue

CocoaPods could not find compatible versions for pod "stripe-react-native":

OS:MAC M1 platform :ios, '11.0' "react-native": "0.64.2", "@stripe/stripe-react-native": "^0.18.1",

Trying to find time to remake a base repo for my case of this error. But in case yours is M1 related, will arch -x86_64 pod install help? or doing the other commands in x86 mode? I have not messed with this yet, but had another project where pods and M1 were a mess any other way

@Mahdi-Farahani
Copy link

Please provide a link to a repo that I can clone to reproduce the error, the JS code wouldn't cause the pod issue
Screen Shot 2022-09-20 at 08 37 13

still i couldn't fix this issue
CocoaPods could not find compatible versions for pod "stripe-react-native":
OS:MAC M1 platform :ios, '11.0' "react-native": "0.64.2", "@stripe/stripe-react-native": "^0.18.1",

Trying to find time to remake a base repo for my case of this error. But in case yours is M1 related, will arch -x86_64 pod install help? or doing the other commands in x86 mode? I have not messed with this yet, but had another project where pods and M1 were a mess any other way

I have Mac M1 and still I have this error could you fix your issue??

@nicolasdevienne
Copy link

Hi @russmenum, have you the minimum requirement of iOS = 12.0 in your Podfile and your Xcode project ?

Hi @Mahdi-Farahani! Maybe you can try this?

@russmenum
Copy link
Author

@Mahdi-Farahani I have not tried to run this rebuild on the M1 yet, still trying to get to a runnable point on Intel Mac, but maybe try arch -x86_64 pod install --repo-update?

It is stupid how many things you still need to run in x86 mode for it to work on an M1 but it is what it is.

@Mahdi-Farahani
Copy link

Mahdi-Farahani commented Sep 23, 2022

i tested and changed package versions - platform :ios - development target -

BUT STILL I HAVE ISSUE :

CocoaPods could not find compatible versions for pod "stripe-react-native":

OS:MAC M1
platform :ios, '11.0'
"react-native": "0.64.2",
"@stripe/stripe-react-native": "^0.18.1",

@charliecruzan-stripe
@thorsten-stripe

@MuhammadAbdullah54321
Copy link

I was facing the same issue when I cloned a old project and tried to tun that in my react native.
The issue in my case was that ios target version in pod file was 10 as like this platform :ios, '10.0'
I changed it to 11 like this platform :ios, '11.0' and it worked

@abbasmoosavi
Copy link

@Mahdi-Farahani Put of iOS platform version in Podfile to 13.0 and test it, my bro.

@77TecShaeer
Copy link

+1

1 similar comment
@OgnjenLF
Copy link

OgnjenLF commented Nov 9, 2022

+1

@varemenos
Copy link

varemenos commented Nov 10, 2022

Warning that more people will slowly start having this issue, since RN 0.71 takes control of the minimum target version (by default, based on the default template and what upgrade-helper will suggest).

https://github.com/facebook/react-native/blob/0.71-stable/template/ios/Podfile#L4

platform :ios, min_ios_version_supported
min_ios_version_supported resolves to 12.4 for RN 0.71.

For those trying to upgrade to 0.71 and experiencing this issue,
change the line platform :ios, min_ios_version_supported in your Podfile with platform :ios, 13.

@russmenum
Copy link
Author

Warning that more people will slowly start having this issue, since RN 0.71 takes control of the minimum target version (by default, based on the default template and what upgrade-helper will suggest).

https://github.com/facebook/react-native/blob/0.71-stable/template/ios/Podfile#L4

platform :ios, min_ios_version_supported min_ios_version_supported resolves to 12.4 for RN 0.71.

For those trying to upgrade to 0.71 and experiencing this issue, change the line platform :ios, min_ios_version_supported in your Podfile with platform :ios, 13.

ok would not ios/app.xcodeproj/project.pbxproj and IPHONEOS_DEPLOYMENT_TARGEToverride that to whatever you set?

maybe do somthing like platform :ios, podfile_properties['ios.deploymentTarget'] || '12.4'

@igorjos
Copy link

igorjos commented Nov 11, 2022

Go to ios folder within your project, open Podfile and change platform :ios, '12.4' to platform :ios, '13.0' this fixed the issue for me.

Just for in case is needed do: remove podfile.lock and also do pod install --repo-update

This is on Mac Air M1 chip.

Hope this helps

@AqeelAsghar
Copy link

guys simply upgrade your pods target to 33
but if but want pod target less than 33 use @stripe/[email protected] that work for me

@varemenos
Copy link

varemenos commented Dec 26, 2022

The question is why are they targeting 13 instead of 12.4 when the platform itself (RN) doesn't? Who is the consumer of this if not React Native projects, which even on the latest release candidate, target 12.4?

@charliecruzan-stripe
Copy link
Collaborator

why are they targeting 13 instead of 12.4

To use the newest versions of the stripe-ios library, you need to target 13.0. But, if you'd like to continue targeting 12.4, then you can use @stripe/[email protected]

@Symyon
Copy link

Symyon commented Jan 4, 2023

I'm using 0.19.0 and have the same issue. I am unable to change the podfile as I am using Expo. What will be the direction to go about fixing/debugging this?

@charliecruzan-stripe
Copy link
Collaborator

If you're using Expo, you need to install the library with expo install @stripe/stripe-react-native: https://github.com/stripe/stripe-react-native#expo

@pawanv048
Copy link

Just go into your pod file min_ios_support platform :ios, '13.0' change in pod file,
if you are using intel chip just do "pod install", and you good to go,
if you have apple chip then, do this "arch -x86_64 pod install"

@younes-ammari
Copy link

changing the line platform :ios, min_ios_version_supported in Podfile with platform :ios, 13 solved it for me.

@facuescobar
Copy link

changing the line platform :ios, min_ios_version_supported in Podfile with platform :ios, 13 solved it for me.

This worked for me as well,

@MirzaArslan123
Copy link

i am just doing
platform :ios, "13.0" in podfile and issue fixed

@elibroftw
Copy link

elibroftw commented Aug 20, 2023

If your Podfile has the following:

platform :ios, min_ios_version_supported

You can modify it like so to avoid breaking your application when react-native itself won't support iOS 13.

MIN_IOS_OVERRIDE = '13.0'
if Gem::Version.new(MIN_IOS_OVERRIDE) > Gem::Version.new(min_ios_version_supported)
    min_ios_version_supported = MIN_IOS_OVERRIDE
end
platform :ios, min_ios_version_supported

@rob5408
Copy link

rob5408 commented Aug 21, 2023

@elibroftw In the Podfile? That gave me an invalid Podfile error. I like this idea though!

@elibroftw
Copy link

@rob5408 Yes, like so:

image

Note that min_ios_version_supported is defined in node_modules\react-native\scripts\react_native_pods.rb in the latest react-native version.

image

@arslanali50
Copy link

if you get rid this error
CocoaPods could not find compatible versions for pod "stripe-react-native "
just run command pod update

@irtazafayaz
Copy link

I tried several things but the one which worked for me was

git config http.postBuffer 1024M

@pateljigar7210
Copy link

run pod update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reproduce Try and reproduce the issue
Projects
None yet
Development

No branches or pull requests