如何解决目标“BVLinearGrandient”和“FBReactNativeSpec”之间的依赖关系循环问题?

May*_*lar 15 xcode ios swift react-native

如上所述,在反应本机项目中出现错误。

\n
Cycle in dependencies between targets 'BVLinearGradient' and 'FBReactNativeSpec'; building could produce unreliable results.\nCycle path: BVLinearGradient \xe2\x86\x92 React \xe2\x86\x92 React-RCTAnimation \xe2\x86\x92 FBReactNativeSpec \xe2\x86\x92 BVLinearGradient\nCycle details:\n\xe2\x86\x92 Target 'BVLinearGradient' has link command with output '/Users/imac/Library/Developer/Xcode/DerivedData/NOFOS-gdkwrmnotgdstiglulxxrepqzeci/Build/Products/Debug-iphonesimulator/BVLinearGradient/BVLinearGradient.framework/BVLinearGradient'\n\xe2\x97\x8b Target 'BVLinearGradient' has compile command with input '/Volumes/WorkSpace/NOFOS/nofosApp/ios/Pods/Target Support Files/BVLinearGradient/BVLinearGradient-dummy.m'\n\xe2\x97\x8b 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\n\xe2\x86\x92 Target 'React' has target dependency on Target 'React-RCTAnimation'\n\xe2\x86\x92 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\n\xe2\x97\x8b Target 'React-RCTAnimation' has target dependency on Target 'FBReactNativeSpec'\n\xe2\x97\x8b That command depends on command in Target 'FBReactNativeSpec': script phase \xe2\x80\x9c[CP-User] Generate Specs\xe2\x80\x9d\n\xe2\x86\x92 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'\n\xe2\x97\x8b That command depends on command in Target 'FBReactNativeSpec': script phase \xe2\x80\x9c[CP-User] Generate Specs\xe2\x80\x9d\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试过多种模式,如下所述。

\n
    \n
  • 清理构建文件夹>>重建。
  • \n
  • 删除 pod 和 podfile.lock >> pod install。
  • \n
  • 删除派生数据>>清理构建文件夹>>重建。
  • \n
  • 关闭 xCode >> rm -rf ~/library/developer/xcode/衍生数据 >> rm -rf ~/.rncache >> rm -rf node_modules && npm install && cd ios && rm -rf Pods && pod install && cd ..
  • \n
\n

在进行上述试验之前,我还重新启动了系统。我在项目中使用了 swift。\n请为此提供一个正确的解决方案。

\n

shi*_*z27 16

我通过执行 \xe2\x8c\x98+Shift+K 并重建解决了不同包的类似问题。

\n


MoO*_*oOx 3

对于这个特定的依赖项(react-native-linear-gradient),修复位于https://github.com/react-native-linear-gradient/react-native-linear-gradient/pull/500但尚未发布然而(当我写这篇文章时)。

react-native-linear-gradient你应该像这样从 git指定版本

package.json

  "react-native-linear-gradient": "https://github.com/react-native-linear-gradient/react-native-linear-gradient#0e3af58",
Run Code Online (Sandbox Code Playgroud)

然后运行 ​​npm/yarn install,清理你的构建并重试。

如果问题仍然存在(或类似),请参阅https://github.com/facebook/react-native/issues/31034#issuecomment-865842707了解更多信息。