facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
117.12k stars 24.07k forks source link

Cycle in dependencies between targets ‘XYZ' and ‘XYZ_appTests' in Xcode for React Native project on macOS #44849

Closed Amritanand25 closed 2 days ago

Amritanand25 commented 3 weeks ago

Description

I am setting up a React Native project on my MacBook Pro and have installed the necessary tools: Node.js, Xcode, Ruby, and CocoaPods. I've also configured .xcode.env properly. Despite following various troubleshooting steps, including reinstalling pods, I am encountering a dependency cycle issue in Xcode. This issue appears to be between the project target XYZ and its test target XYZ_appTests.

Here is the specific error message I'm receiving in Xcode:

Showing All Messages
Cycle in dependencies between targets 'XYZ' and 'XYZ_appTests'; building could produce unreliable results.
Cycle path: XYZ → XYZ_appTests → XYZ
Cycle details:
→ Target 'XYZ' has an explicit dependency on Target 'XYZ_appTests'
→ Target 'XYZ_appTests' has an explicit dependency on Target 'XYZ'

Raw dependency cycle trace:

target:  ->

node: <all> ->

command: <all> ->

node: /Users/ABC/Library/Developer/Xcode/DerivedData/XYZ_app-fxthweyuptefnvbhpnarzdbbdzjd/Build/Products/Debug-iphonesimulator/XYZ_app.app/Frameworks/XCTAutomationSupport.framework ->

command: P0:target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:Copy /Users/ABC/Library/Developer/Xcode/DerivedData/XYZ_app-fxthweyuptefnvbhpnarzdbbdzjd/Build/Products/Debug-iphonesimulator/XYZ_app.app/Frameworks/XCTAutomationSupport.framework /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework ->

CYCLE POINT ->

node: <target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--ModuleVerifierTaskProducer> ->

command: P0:::Gate target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--ModuleVerifierTaskProducer ->

node: <target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--ModuleMapTaskProducer> ->

command: P0:::Gate target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--ModuleMapTaskProducer ->

node: <target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--HeadermapTaskProducer> ->

command: P0:::Gate target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--HeadermapTaskProducer ->

node: /Users/ABC/Library/Developer/Xcode/DerivedData/XYZ_app-fxthweyuptefnvbhpnarzdbbdzjd/Build/Intermediates.noindex/XYZ_app.build/Debug-iphonesimulator/XYZ.build/all-product-headers.yaml ->

Steps to reproduce

I understand that this kind of dependency cycle can cause unreliable build results, but I'm unsure how to resolve this. I've tried the following steps without success:

Despite these efforts, the issue persists. How can I fix this dependency cycle between the XYZ and XYZ_appTests targets? Any guidance or suggestions would be greatly appreciated.

Thank you!

React Native Version

0.73.2

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.5
  CPU: (8) arm64 Apple M1
  Memory: 163.67 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.14.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.3.0
    path: ~/peso-app-react-native-cli/node_modules/.bin/npm
  Watchman:
    version: 2024.05.06.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.3 AI-233.14808.21.2331.11842104
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.2
    wanted: 0.73.2
  react-native-macos: Not Found
npmGlobalPackages:
  "react-native": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

info React Native v0.74.2 is now available (your project is running on v0.73.2).

Stacktrace or Logs

Showing All Messages
Cycle in dependencies between targets 'XYZ' and 'XYZ_appTests'; building could produce unreliable results.
Cycle path: XYZ → XYZ_appTests → XYZ
Cycle details:
→ Target 'XYZ' has an explicit dependency on Target 'XYZ_appTests'
→ Target 'XYZ_appTests' has an explicit dependency on Target 'XYZ'

Raw dependency cycle trace:

target:  ->

node: <all> ->

command: <all> ->

node: /Users/ABC/Library/Developer/Xcode/DerivedData/XYZ_app-fxthweyuptefnvbhpnarzdbbdzjd/Build/Products/Debug-iphonesimulator/XYZ_app.app/Frameworks/XCTAutomationSupport.framework ->

command: P0:target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:Copy /Users/ABC/Library/Developer/Xcode/DerivedData/XYZ_app-fxthweyuptefnvbhpnarzdbbdzjd/Build/Products/Debug-iphonesimulator/XYZ_app.app/Frameworks/XCTAutomationSupport.framework /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework ->

CYCLE POINT ->

node: <target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--ModuleVerifierTaskProducer> ->

command: P0:::Gate target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--ModuleVerifierTaskProducer ->

node: <target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--ModuleMapTaskProducer> ->

command: P0:::Gate target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--ModuleMapTaskProducer ->

node: <target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--HeadermapTaskProducer> ->

command: P0:::Gate target-XYZ-6f744c8ebba6034abf56e0311272f9237ceb6b36bcfc2fb90f69ac96de4975d6--HeadermapTaskProducer ->

node: /Users/ABC/Library/Developer/Xcode/DerivedData/XYZ_app-fxthweyuptefnvbhpnarzdbbdzjd/Build/Intermediates.noindex/XYZ_app.build/Debug-iphonesimulator/XYZ.build/all-product-headers.yaml ->

Reproducer

AmritAnand1

Screenshots and Videos

No response

github-actions[bot] commented 3 weeks ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.73.8. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
github-actions[bot] commented 3 weeks ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
cortinico commented 3 weeks ago

Please provide a valid reproducer

github-actions[bot] commented 2 days ago

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

cortinico commented 2 days ago

Closing as no reproducer was provided

Amritanand25 commented 2 days ago

Hey Cortinico, I'm trying to run a React Native app on macOS following the documentation. I did everything mentioned, but when I try to run the code, I get an error in Xcode saying there is a cycle in dependencies between targets ‘XYZ’ and ‘XYZ_appTests’. Can you help me understand why this error occurs and how to solve it?