You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行npx react-native run-ios遇Xcode构建错误(错误码65)求解决方案

React Native iOS项目启动失败(error code 65)解决办法

执行npx react-native run-ios启动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 test.xcworkspace.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace test.xcworkspace -configuration Debug -scheme test -destination id=8E4F9416-0C08-4ACA-B41D-D950C2208A66

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Prepare packages

........

Computing target dependency graph and provisioning inputs   

 The following build commands failed:
        PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/mohammedsuja/Library/Developer/Xcode/DerivedData/test-eabnxomykigrnaepxsyqxilqoeiw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-rncore.build/Script-46EB2E00018190.sh (in target 'React-rncore' from project 'Pods')
    (1 failure)

解决步骤

  • 清理Pod依赖与缓存

    1. 进入项目ios目录:cd ios
    2. 删除Pod锁文件和Pods文件夹:rm -rf Podfile.lock Pods
    3. 清除Xcode派生数据:rm -rf ~/Library/Developer/Xcode/DerivedData
    4. 重新安装Pods:pod install
  • 检查Xcode配置

    1. 打开项目的test.xcworkspace(不要打开.xcodeproj文件)
    2. 确认项目Bundle Identifier正确,在Signing & Capabilities面板选择匹配的开发团队
    3. 修复脚本权限:找到Pods项目下的React-rncore目标,进入Build Phases面板,定位[CP-User] Generate Specs脚本,在终端执行chmod +x /Users/mohammedsuja/Library/Developer/Xcode/DerivedData/test-eabnxomykigrnaepxsyqxilqoeiw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-rncore.build/Script-46EB2E00018190.sh赋予可执行权限
  • 适配依赖版本

    1. 若使用的React Native版本较旧,升级到稳定版:npx react-native upgrade
    2. 核对package.json与Podfile中的依赖版本,确保二者适配当前React Native版本
  • 重新构建项目

    1. 在Xcode中执行Clean Build Folder(快捷键Cmd+Shift+K)
    2. 选择对应模拟器,点击Build按钮尝试构建
    3. Xcode构建成功后,回到终端执行npx react-native run-ios

内容的提问来源于stack exchange,提问作者Mohamed suja

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 10:15:11