首页 > 解决方案 > 未找到无法识别的模块映射文件 Release-iphonesimulator/YogaKit/YogaKit.modulemap'

问题描述

我创建了一个新的 react-native 项目,我正在尝试构建 iOS 代码,但它失败并出现以下错误:

致命错误:模块映射文件

'/Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Products/Release-iphonesimulator/YogaKit/YogaKit.modulemap' not found

react-native 版本:react-native-cli:2.0.1 react-native:0.62.2

来自 Xcode 的堆栈跟踪:

CompileC /Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/Objects-normal/x86_64/thoughtrail_vers.o /Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/DerivedSources/thoughtrail_vers.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'thoughtrail' from project 'thoughtrail')
    cd /Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-ios9.0-simulator -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fmodules -gmodules -fmodules-cache-path=/Users/ritz/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/ritz/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCOCOAPODS=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -iquote /Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/thoughtrail-generated-files.hmap -I/Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/thoughtrail-own-target-headers.hmap -I/Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/thoughtrail-all-target-headers.hmap -iquote /Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/thoughtrail-project-headers.hmap -I/Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Products/Release-iphonesimulator/include -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/CocoaAsyncSocket -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/CocoaLibEvent -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/DoubleConversion -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/FBLazyVector -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/FBReactNativeSpec -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/Flipper -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/Flipper-DoubleConversion -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/Flipper-Folly -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/Flipper-Glog -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/Flipper-PeerTalk -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/Flipper-RSocket -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/FlipperKit -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/OpenSSL-Universal -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/RCTRequired -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/RCTTypeSafety -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/React-Core -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/React-RCTText -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/React-cxxreact -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/React-jsi -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/React-jsiexecutor -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/React-jsinspector -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/ReactCommon -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/Yoga -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/YogaKit -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/glog -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/react-native-webview -I/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Private/React-Core -I/Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/DerivedSources-normal/x86_64 -I/Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/DerivedSources/x86_64 -I/Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/DerivedSources -F/Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Products/Release-iphonesimulator -fmodule-map-file=/Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Products/Release-iphonesimulator/YogaKit/YogaKit.modulemap -fmodule-map-file=/Users/ritz/Documents/workspace/threesixnine/thoughtrail/source/mobile/thoughtrail/ios/Pods/Headers/Public/yoga/Yoga.modulemap -MMD -MT dependencies -MF /Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/Objects-normal/x86_64/thoughtrail_vers.d --serialize-diagnostics /Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/Objects-normal/x86_64/thoughtrail_vers.dia -c /Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/DerivedSources/thoughtrail_vers.c -o /Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Intermediates.noindex/thoughtrail.build/Release-iphonesimulator/thoughtrail.build/Objects-normal/x86_64/thoughtrail_vers.o

好心提醒。

标签: iosxcodereact-native

解决方案


发现问题:

  1. 我打开了一个xcproject文件而不是xcworkspace. 由于我使用的是 react-native,而后者又使用了 COCOA,因此我需要打开xcworkspace.

  2. 上述错误的原因是生成的运行时项目构建目录中没有可用的 POD 目标可用文件。

所以我将目标支持文件从 PODS 目录复制到动态生成的路径,如下所示 /Users/ritz/Library/Developer/Xcode/DerivedData/thoughtrail-blthhaitoghgvzenyxayuwazwzfm/Build/Products/Debug-iphonesimulator

构建向前推进,但由于其他原因失败了。

所以总结这个问题基本上是我打开xcproject而不是xcworkspace。

希望这对像我这样的初学者有所帮助。


推荐阅读