How to fix issue of cycle in dependencies between targets 'BVLinearGrandient' and 'FBReactNativeSpec'?

Viewed 4116

Getting error in react-native project as ahead.

Cycle in dependencies between targets 'BVLinearGradient' and 'FBReactNativeSpec'; building could produce unreliable results.
Cycle path: BVLinearGradient → React → React-RCTAnimation → FBReactNativeSpec → BVLinearGradient
Cycle details:
→ Target 'BVLinearGradient' has link command with output '/Users/imac/Library/Developer/Xcode/DerivedData/NOFOS-gdkwrmnotgdstiglulxxrepqzeci/Build/Products/Debug-iphonesimulator/BVLinearGradient/BVLinearGradient.framework/BVLinearGradient'
○ Target 'BVLinearGradient' has compile command with input '/Volumes/WorkSpace/NOFOS/nofosApp/ios/Pods/Target Support Files/BVLinearGradient/BVLinearGradient-dummy.m'
○ Target 'BVLinearGradient' has write command with output /Users/imac/Library/Developer/Xcode/DerivedData/NOFOS-gdkwrmnotgdstiglulxxrepqzeci/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/BVLinearGradient.build/module.modulemap
→ Target 'React' has target dependency on Target 'React-RCTAnimation'
→ Target 'React-RCTAnimation' has write command with output /Users/imac/Library/Developer/Xcode/DerivedData/NOFOS-gdkwrmnotgdstiglulxxrepqzeci/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTAnimation.build/module.modulemap
○ Target 'React-RCTAnimation' has target dependency on Target 'FBReactNativeSpec'
○ That command depends on command in Target 'FBReactNativeSpec': script phase “[CP-User] Generate Specs”
→ Target 'FBReactNativeSpec' has copy command from '/Volumes/WorkSpace/NOFOS/nofosApp/node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h' to '/Users/imac/Library/Developer/Xcode/DerivedData/NOFOS-gdkwrmnotgdstiglulxxrepqzeci/Build/Products/Debug-iphonesimulator/FBReactNativeSpec/FBReactNativeSpec.framework/Headers/FBReactNativeSpec.h'
○ That command depends on command in Target 'FBReactNativeSpec': script phase “[CP-User] Generate Specs”

I have tried with many patterns as mentioned below.

  • Clean build folder >> rebuild.
  • Delete pods and podfile.lock >> pod install.
  • Delete derived data >> clean build folder >> rebuild.
  • close xCode >> rm -rf ~/library/developer/xcode/deriveddata >> rm -rf ~/.rncache >> rm -rf node_modules && npm install && cd ios && rm -rf Pods && pod install && cd ..

I have also restart the system before doing the above trials. And I have used swift in the project. Please provide me a proper solution for this.

3 Answers

I solved a similar problem of a different package by doing ⌘+Shift+K and rebuilding.

For this particular dependency (react-native-linear-gradient), the fix is in https://github.com/react-native-linear-gradient/react-native-linear-gradient/pull/500 but has not been released yet (when I am writing this).

You should specify react-native-linear-gradient version from git like this

package.json

  "react-native-linear-gradient": "https://github.com/react-native-linear-gradient/react-native-linear-gradient#0e3af58",

Then run npm/yarn install, clean your build & try again.

If issue persist (or is similar) please refer to https://github.com/facebook/react-native/issues/31034#issuecomment-865842707 for a more informations.

For FBReactNativeSpec,

credit to [paulxuca]'s answer 1

Click on the Pods project on the left sidebar Go under Build Phases Make sure [CP-User] Generate Specs is before Headers

enter image description here

Related