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

# Bug Report: Dependency Conflict with customerio-reactnative #365

Closed
Valentin-Gaudin opened this issue Dec 13, 2024 · 4 comments
Closed

Comments

@Valentin-Gaudin
Copy link

Valentin-Gaudin commented Dec 13, 2024

SDK version

  • Customer.io SDK: ^3.9.1
  • Expo SDK: 52

Environment

  • Environment: Development (EAS Build)

Are logs available?

No logs are currently available, but the following error is encountered during the eas build process:

[!] 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)

Describe the bug

When running the eas build command, the build fails due to conflicting dependencies for customerio-reactnative in the Podfile. The error suggests that the library is being referenced twice with different paths:

  1. ../node_modules/customerio-reactnative
  2. ../../node_modules/customerio-reactnative/apn.

This appears to be caused by incorrect path resolution in a monorepo workspace structure.

To Reproduce

Appears in expo build online

  1. Project setup:
    • Monorepo workspace with a native folder for builds.
    • Shared node_modules directory.
  2. Install dependencies using Yarn or npm.
  3. Run the following command to build:
eas build -p ios --profile development

Expected behavior

The build should complete without dependency resolution errors.

Screenshots

image

Additional context

Project configuration: Monorepo using Expo and React Native.
Structure: The native folder contains generated native code (iOS/Android), and dependencies are declared in a shared workspace.

@mahmoud-elmorabea
Copy link
Contributor

Thanks for the detailed report!

I'd like to confirm a few things to be able to better help with the issue:

  • You are using our Expo plugin with your app? (This repo is for vanilla ReactNative SDK without Expo)
  • In your monorepo setup do customerio-expo-plugin and customerio-reactnative live in different node_modules directories?
  • Can you elaborate on the structure of your project and how is CIO Expo plugin is added as a dependency and configured? Attaching CIO Expo, CIO RN SDK and Expo versions would be helpful.
  • Attaching the generated Podfile could be help as well

We don't have explicit support for monorepos with our Expo plugin so if in fact customerio-expo-plugin and customerio-reactnative do reside in the same node_modules directory, that could be causing the issue.

If you are not comfortable sharing any of the information here, feel free to contact us through [email protected] and mention this ticket number.

@Valentin-Gaudin
Copy link
Author

You’r welcome !

  • Yes i use the customerio-expo-plugin in the app with this latest release : 4.1.1
  • They are not leaving in different directories, just in native folder
  • The project are living in this way :
├ ROOT FOLDER
├── common
│   ├── node_modules
│   └── package.json
├── native
│   ├── node_modules
│   |   ├── customerio-expo-plugin
│   |   ├── customerio-reactnative
│   |   ├── react
│   |   └── react-native
│   └── package.json
├── node_modules
├── package.json
├── web
│   ├── node_modules
│   └── package.json
└── yarn.lock

Next the package.json of the native folder :

{
  "name": "native",
  "version": "1.0.1",
  "main": "index.js",
  "scripts": {
    "eas-build-pre-install": "./scripts/eas-build-pre-install.sh",
     ...
  },
  "comments": {
    "dependencies": {
      "libphonenumber-js": "DO NOT UPGRADE to 1.10.0 breaking changes"
    }
  },
  "dependencies": {
    "@expo/config-plugins": "~9.0.0",
    "@fortawesome/react-native-fontawesome": "^0.3.1",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-community/checkbox": "^0.5.12",
    "@react-native-community/datetimepicker": "8.2.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-picker/picker": "2.9.0",
    "@react-navigation/bottom-tabs": "^6.5.8",
    "@react-navigation/core": "^6.4.9",
    "@react-navigation/elements": "^1.3.18",
    "@react-navigation/material-top-tabs": "^6.6.3",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/stack": "^6.3.17",
    "@sentry/react-native": "~6.3.0",
    "customerio-expo-plugin": "^1.0.0-beta.17",
    "customerio-reactnative": "^4.1.1",
    "date-fns": "^2.28.0",
    "expo": "~52.0.18",
    "expo-apple-authentication": "~7.1.2",
    "expo-application": "~6.0.1",
    "expo-auth-session": "~6.0.1",
    "expo-blur": "~14.0.1",
    "expo-build-properties": "~0.13.1",
    "expo-clipboard": "~7.0.0",
    "expo-constants": "~17.0.3",
    "expo-dev-client": "~5.0.6",
    "expo-device": "~7.0.1",
    "expo-document-picker": "~13.0.1",
    "expo-file-system": "~18.0.5",
    "expo-image-manipulator": "~13.0.5",
    "expo-image-picker": "~16.0.3",
    "expo-linear-gradient": "~14.0.1",
    "expo-linking": "~7.0.3",
    "expo-location": "~18.0.4",
    "expo-notifications": "~0.29.11",
    "expo-random": "~14.0.1",
    "expo-sharing": "~13.0.0",
    "expo-splash-screen": "~0.29.18",
    "expo-status-bar": "~2.0.0",
    "expo-tracking-transparency": "~5.1.0",
    "expo-updates": "~0.26.10",
    "firebase": "^9.9.0",
    "ibantools": "^4.1.5",
    "libphonenumber-js": "1.9.53",
    "lottie-react-native": "7.1.0",
    "react-fast-compare": "^3.2.1",
    "react-native": "0.76.5",
    "react-native-appsflyer": "^6.14.3",
    "react-native-circular-progress": "^1.3.7",
    "react-native-confetti-cannon": "^1.5.2",
    "react-native-dotenv": "^2.4.2",
    "react-native-elements": "^3.4.2",
    "react-native-gesture-handler": "~2.20.2",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-maps": "1.18.0",
    "react-native-markdown-display": "^7.0.2",
    "react-native-mask-text": "^0.7.0",
    "react-native-modal-datetime-picker": "^14.0.1",
    "react-native-pager-view": "6.5.1",
    "react-native-portalize": "^1.0.7",
    "react-native-reanimated": "^3.16.3",
    "react-native-redash": "^16.2.3",
    "react-native-root-siblings": "^4.1.1",
    "react-native-safe-area-context": "4.12.0",
    "react-native-screens": "~4.1.0",
    "react-native-svg": "15.8.0",
    "react-native-tab-view": "^3.5.2",
    "react-native-ux-cam": "^5.4.5",
    "react-native-vector-icons": "^9.1.0",
    "react-native-web": "~0.19.13",
    "react-native-webview": "13.12.5",
    "rn-pdf-reader-js": "^4.1.1",
    "styled-components": "^5.3.3",
    "styled-system": "^5.1.5",
    "ts-node": "10.9.1"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@types/styled-components": "^5.1.24",
    "@types/styled-components-react-native": "^5.1.3",
    "@types/styled-system": "^5.1.15",
    "babel-plugin-transform-inline-environment-variables": "^0.4.3",
    "babel-preset-expo": "~12.0.0",
    "husky": "^7.0.4",
    "jest-expo": "~52.0.2",
    "lint-staged": "^12.3.7",
    "patch-package": "^6.4.7",
    "pretty-quick": "^3.1.3",
    "react-test-renderer": "^18.2.0"
  },
  "private": true
}

And the Podfile :

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")

require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}

ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0'
ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']

platform :ios, podfile_properties['ios.deploymentTarget'] || '15.1'
install! 'cocoapods',
  :deterministic_uuids => false

prepare_react_native_project!

target 'PROJECT ENTERPRISE' do
# @generated begin react-native-maps - expo prebuild (DO NOT MODIFY) sync-******
  pod 'react-native-google-maps', path: File.dirname(`node --print "require.resolve('react-native-maps/package.json')"`)
# @generated end react-native-maps
  config = use_native_modules!(config_command)

  use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
  use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    :privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false',
  )

# --- CustomerIO Host App START ---
  pod 'customerio-reactnative/apn', :path => '../node_modules/customerio-reactnative'
# --- CustomerIO Host App END ---
  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      :ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true',
    )

    # This is necessary for Xcode 14, because it signs resource bundles by default
    # when building for devices.
    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end
end
# --- CustomerIO Notification START ---
target 'NotificationService' do
  use_frameworks! :linkage => :static
  pod 'customerio-reactnative-richpush/apn', :path => '../node_modules/customerio-reactnative'
end
# --- CustomerIO Notification END ---

@Valentin-Gaudin
Copy link
Author

If you want any more necessary informations, don’t hesitate to ask me ! :)

@Valentin-Gaudin
Copy link
Author

Valentin-Gaudin commented Dec 18, 2024

I close this issue, i will in charge to upgrade to 4.1.1.

And this issue is resolved after adapt my workspace with dependencies

@mahmoud-elmorabea Thank at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants