expo: "Cycle in dependencies between targets 'EXApplication' and 'ExpoModulesCore'" error when "expo run:ios" after running "expo export"

Summary

Hi,

I am developing an app under the managed worfklow, but since I needed a RN module I had to manage both expo and native modules (my customer is checking the app development with Expo Go, it is so easy to deploy that I dont want to switch 100% to Custom dev client for now)

After having deployed for the first time to my private server with expo export , I went back to expo run:ios and found myself with this error

Cycle in dependencies between targets 'EXApplication' and 'ExpoModulesCore'; building could produce unreliable results.

and couldn’t build at all.

Fixed it by deleting the ios folder in the project; although it shouldn’t be an error I guess

PS : I’m so fond of the way I can’t develop thanks to Expo Go for quick adhoc distribution and custom dev client for the realworld behaviour of an app, magical!

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

43

Environment

Expo CLI 4.12.10 environment info: System: OS: macOS 12.0.1 Shell: 5.8 - /bin/zsh Binaries: Node: 12.18.3 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.20.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0 IDEs: Android Studio: 4.1 AI-201.8743.12.41.7042882 Xcode: 13.1/13A1030d - /usr/bin/xcodebuild npmPackages: expo: ^43.0.1 => 43.0.1 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.2 => 0.64.2 react-native-web: 0.17.1 => 0.17.1 react-navigation: ^4.4.4 => 4.4.4 npmGlobalPackages: expo-cli: 4.12.10 Expo Workflow: bare

Reproducible demo or steps to reproduce from a blank project

Run expo export on a project, and then expo run:ios It should crash saying there’s a conflict in the cycle in dependencies between targets ‘EXApplication’ and ‘ExpoModulesCore’ Deleting the ios folder resulting from expo export and then running expo run should fix the problem

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 23 (6 by maintainers)

Most upvoted comments

I’m having same issue and none of the above solutions worked for me. XCode 13.1.

cd ios && rm -rf Pods && pod install && cd .. helped for me for some reason. Maybe someone will find it useful

@raphaelmsr @just-a-normal-human not sure if this helps for your guys use case, but for my scenario where I was getting Cycle in dependencies between targets 'EXApplication' and 'ExpoModulesCore' I got it to work by moving the Compile Sources phase of compilation to be before the Headers phase.

I did this by:

  1. Opening Pods/Pods.xcodeproj in Xcode
  2. Opening the Issue Navigator
  3. Selecting the ExpoModulesCore target
  4. Selecting Build Phases
  5. Moving Compile Sources to be above Headers

I posted a screenshot of how I have ExpoModulesCore configured. Previously, Headers was above Compile Sources

Screen Shot 2021-11-29 at 7 41 29 PM

to solve the issue you have to remove the Pods directory.

rm -fr ios/Pods && yarn ios

it happens very often.

Add this to your Podfile:

  post_integrate do |installer|
    update_pod_build_phase_order("./Pods/Pods.xcodeproj", "ExpoModulesCore")
  end

  def update_pod_build_phase_order(xcodeproj_path, target_name)
    puts "Updating build phase order of 'Headers' in #{xcodeproj_path}, #{target_name} \n"
    project = Xcodeproj::Project.open(xcodeproj_path)
    target = project.targets.select { |t| t.name == target_name }.first
    puts "Found target: #{target.name}\n"
    cocoapods_index = target.build_phases.index do |b|
      puts "#{b} , #{b == "HeadersBuildPhase"}"
      b.to_s == "HeadersBuildPhase"
    end
    if cocoapods_index.nil? == false
        puts "#{target_name}: 'HeadersBuildPhase' index was: #{cocoapods_index}, moving to index 1.\n"
        target.build_phases.move_from(cocoapods_index, 1)
    end
    project.save
  end

to summarize - if you encounter this error, you may need to clear and reinstall pods.

Why on earth are people celebrating these comments. Deleting and reinstalling Pods is not the correct solution. If you’re going to make me use the entire bulls*** ecosystem of Expo tools just to use your Secure Storage plugin - the least you can do it ensure it doesn’t build like dirt.

I was facing with this issue in several projects.

Only “solution” that has worked for me was

Create new react-native project (0.68.2) Install expo 45 Do every native module setup step for each library Copy src folder to the new project Test each module, if they are working

Now I have saved tons of hours by not having to do “remove pods, reinstall again, fail, remove pods, reinstall again, hope to not fail, fail” I love my life.

@brentvatne Yeah, I get that. I let my frustration take over my logical thinking. I’ve revoked the previous comments, apologies for the abrupt approach.

I’m having same issue and none of the above solutions worked for me. XCode 13.1.

error: Cycle in dependencies between targets 'EXApplication' and 'ExpoModulesCore'; building could produce unreliable results.
Cycle path: EXApplication → ExpoModulesCore → EXApplication

yarn why expo-modules-core returns only one version:

=> Found "expo-modules-core@0.4.7"