Xcode 15.3执行react-native run-ios或运行时出现PhaseScriptExecution错误
解决React Native iOS构建报错:Command PhaseScriptExecution failed with a nonzero exit code
先处理重复模拟器警告
- 打开Xcode,进入
Window > Devices and Simulators - 在Simulators标签下找到重复的iPhone SE (3rd generation)实例,删除多余的那个
- 或者用命令行直接删除重复实例:
xcrun simctl delete 6E42CF4B-E0CD-40CE-99F8-81AF07DEC3D5
清理缓存与重建依赖
- 清理Node模块和缓存:
rm -rf node_modules npm cache clean --force npm install - 清理iOS Pods依赖并重新安装:
cd ios rm -rf Pods Podfile.lock pod deintegrate pod install - 删除Xcode派生数据(报错里指定的目录):
rm -rf ~/Library/Developer/Xcode/DerivedData/Vincho-blolxiechfckjwewixzdfkxtcoiw
修复脚本执行权限
- 给报错的Shell脚本添加执行权限:
chmod +x /Users/user/Library/Developer/Xcode/DerivedData/Vincho-blolxiechfckjwewixzdfkxtcoiw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-rncore.build/Script-46EB2E0001DA30.sh - 也可以在Xcode里检查:打开Pods工程的React-rncore目标,进入Build Phases,找到[CP-User] Generate Specs脚本,确认Shell路径为
/bin/sh,且脚本有执行权限。
重新构建
- 关闭Xcode,重新打开项目
- 执行
react-native run-ios,或者在Xcode中选择正确的模拟器后点击运行
内容的提问来源于stack exchange,提问作者Alireza Piran
相关产品推荐
相关产品推荐

