我在 XCode 中运行 IOS 模拟器时遇到问题,每次我尝试运行模拟器时,都会收到一条错误消息:
"fatal error: module map file '/Users/maurice/Library/Developer/Xcode/DerivedData/feedIt-etmfdpwrwadziocunpypqhkwucsd/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found"
预期行为: XCode 运行模拟器。
实际行为: 构建失败,我收到所描述的错误消息。
我已经尝试更新 Pod 并删除派生数据,但显然这不起作用。
如何解决这个问题?
我在 MacOS 10.15.5 和 XCode 11.6 上运行
如果您使用的是 M1 芯片 Mac,请将其添加到您的 Podfile 中
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
所描述的解决方案将在 Apple 芯片上 100% 工作,并且在没有 Rosetta 的情况下运行 Xcode。
请仅尝试必要的步骤,但如果仍然不起作用,请尝试一切,包括必要和不必要的步骤。
1 - 不重要(Package.json)
"dependencies": {
"react": "17.0.1",
"react-native": "0.64.2"
}
2 - 必要
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
installer.pods_project.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
或
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
end
end
end
3 - 在架构 -> 排除架构下添加
arm64
4 - 在你的项目下添加一个 swift 文件,可以是空的,可以是 BridgingFile.swift(没什么特别的),这将触发一个桥接标头。 Wallah,给你。
收到此错误时我面临的问题是,我在 Xcode 中打开了错误的文件。我没有打开“.xcworkspace”文件,而是打开“.xcodeproj”文件。
此问题的解决方案是在 Xcode 中打开“.xcworkspace”文件,而不是“.xcodeproj”文件。
我已经解决了这个问题,通过添加到 Debug Any iOS Simulator SDK 并使用值 arm64 来排除 Pods 项目中的架构(苹果 MacBook 临m1)
就我而言,这是通过改变来解决的 仅构建活动架构>发布>是在构建设置中
确保 podfile、项目和目标中的部署目标应相同。
我的问题是没有设置 VALID_ARCHS = "arm64 arm64e armv7 armv7s x86_64";像这样在 xyzApp/ios/xyzApp.xcodeproj/project.pbxproj
尝试使用以下命令在终端上运行项目: npx 反应本机运行 ios 然后再次在 Xcode 上运行它
可悲的是,上述所有答案都没有解决问题。 我花了2天的时间寻找,现在已经解决了。
pod 'YogaKit', '~> 1.7'
pod 分解 && pod 设置 && pod 安装
一旦原因可以导出此错误设置为
User-Defined
。最近,我拉了一个项目来继续开发。我无法在模拟器上构建它。总是这样的错误。
找不到模块图
对于所有库。我花了很多次才解决这个问题。我检查了所有配置并发现问题是以前的开发集
VALID_ARCHS
仅:arm64e armv7s arm64
我将其更改为ios设备和模拟器:
arm64 arm64e armv7 armv7s x86_64
或简单地从VALID_ARCHS
中删除User-Defined
。
现在可以工作了。希望这有帮助:-)
brew uninstall watchman
brew install watchman
或 arch arm64 brew install watchman
(如果您使用的是 M1)cd ios && rm -rf Pods Podfile.lock && pod install --repo-update
watchman watch-del-all
yarn react-native run-los
我在不同的包和 React Native 设置中看到了这个错误,但找不到任何有关如何修复它的信息。经过多次尝试和错误,我找到了解决方案:
ios/Pods/Pods.xcodeproj
此后,我能够通过 XCode 和使用 React Native 工具再次构建项目。