React Native iOS项目运行失败(错误码65)求助
React Native iOS项目构建失败(error code 65)
运行基础React Native模板项目时,iOS设备/模拟器均出现大量日志及如下错误:
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening AwesomeProject.xcworkspace. Command line invocation: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace AwesomeProject.xcworkspace -configuration Debug -scheme AwesomeProject -destination id=00008020-000235011E30003A warning: Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'AwesomeProject' from project 'AwesomeProject') warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'AwesomeProject' from project 'AwesomeProject') 2023-04-02 20:56:35.729 xcodebuild[35890:143095] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) ** BUILD FAILED ** The following build commands failed: CompileC /Users/nicolelopezfeliz/Library/Developer/Xcode/DerivedData/AwesomeProject-elruyvhqgfpifqffdidsgwslnoos/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/React-Codegen.build/Objects-normal/arm64/FBReactNativeSpec-generated.o /Users/nicolelopezfeliz/Desktop/dev/AwesomeProject/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-Codegen' from project 'Pods') (1 failure) info Run CLI with --verbose flag for more details.
操作步骤
- 执行命令
npx react-native@latest init AwesomeProject初始化模板项目 - 在另一个终端执行
npx react-native start启动Metro服务 - 执行
npx react-native run-ios尝试运行项目 - 尝试在Xcode中打开
AwesomeProject.xcworkspace直接构建运行,仍触发相同错误
已尝试的解决方法
- 卸载多余Node.js版本,仅保留单个版本
- 进入项目iOS目录执行
pod install重新安装依赖
环境信息
- 设备:搭载M2 Pro芯片的MacBook Pro
- 已安装Rosetta
- 严格遵循官方文档操作流程,模拟器与真机运行均出现相同构建失败问题
内容的提问来源于stack exchange,提问作者Nicole Lopez
相关产品推荐
相关产品推荐

