customerio / customerio-reactnative

MIT License
23 stars 11 forks source link

`multiple dependencies with different sources` error during pod install #284

Open tomrom-pomelo opened 1 week ago

tomrom-pomelo commented 1 week ago

SDK version: customerio-reactnative 3.7.2 customerio-expo-plugin 1.0.0-beta.15 react-native 0.74.2 expo 51.0.14

Environment: Development

Are logs available? No, fail during build

Describe the bug When running pod install, I see the error

Analyzing dependencies
[!] There are multiple dependencies with different sources for `customerio-reactnative` in `Podfile`:
- customerio-reactnative (from `../node_modules/customerio-reactnative`)
- customerio-reactnative/apn (from `../../../node_modules/customerio-reactnative`)

I am running this with Expo's eas build on Expo 51

To Reproduce eas build --platform ios

Expected behavior

Screenshots

Additional context

ami-aman commented 1 week ago

Hey @tomrom-pomelo

Thanks for reaching out.

This issue looks very similar to another GitHub issue here on a monorepo project. Would you confirm if your project is a monorepo?

tomrom-pomelo commented 1 week ago

Yes we are using a monorepo

tomrom-pomelo commented 1 week ago

I had to manually patch this line to get it to install https://github.com/customerio/customerio-expo-plugin/blob/309e3614eccbed0b66388c158206ae4b2bf6f791/src/helpers/utils/injectCIOPodfileCode.ts#L22-L24 . Would love if this plugin supported monorepos so we could remove the patch in the future

ami-aman commented 6 days ago

@tomrom-pomelo

Our plugin does support monorepo. It automatically finds the relative path to the react native package and uses it in the podfile.

Is the patch you made fetches different path than what our plugin gets?

tomrom-pomelo commented 6 days ago

Unfortunately that code to find the relative path does not work in our monorepo (note that we don’t have an issue with any other package). This is the patch we apply:

diff --git a/lib/module/helpers/utils/injectCIOPodfileCode.js b/lib/module/helpers/utils/injectCIOPodfileCode.js
index 71567ea16e0162db29d30f37f334bc192751c376..5199e8613df8d852b93d5a99a0e701ea3c3a3ad4 100644
--- a/lib/module/helpers/utils/injectCIOPodfileCode.js
+++ b/lib/module/helpers/utils/injectCIOPodfileCode.js
@@ -1,4 +1,3 @@
-import { getRelativePathToRNSDK } from '../constants/ios';
 import { injectCodeByRegex } from './codeInjection';
 import { FileManagement } from './fileManagement';
 export async function injectCIOPodfileCode(iosPath) {
@@ -14,7 +13,7 @@ export async function injectCIOPodfileCode(iosPath) {
     const lineInPodfileToInjectSnippetBefore = /post_install do \|installer\|/;
     const snippetToInjectInPodfile = `
 ${blockStart}
-  pod 'customerio-reactnative/apn', :path => '${getRelativePathToRNSDK(filename)}'
+  pod 'customerio-reactnative/apn', :path => '../node_modules/customerio-reactnative'
 ${blockEnd}
 `.trim();
     FileManagement.write(filename, injectCodeByRegex(podfile, lineInPodfileToInjectSnippetBefore, snippetToInjectInPodfile).join('\n'));
ami-aman commented 3 days ago

Thanks for sharing the patch fix @tomrom-pomelo but we are unable to reproduce this issue on our end. If you'd like us to investigate further then I would request you to share the project structure that we could use to reproduce on our end. You could also either share a GitHub link with us if you'd like, on win@customer.io and mention this issue.