我正在遵循React Native官方网站上的教程。

使用以下来构建我的项目:

react-native run-ios

我得到了错误:

Found Xcode project TestProject.xcodeproj
xcrun: error: unable to find utility "instruments", not a developer   
tool or in PATH

Command failed: xcrun instruments -s
xcrun: error: unable to find utility "instruments", not a developer 
tool or in PATH

虽然,当我从.xcodeproj运行应用程序时,一切正常。

有什么建议吗?


当前回答

在Mac中:毕竟,你会得到这个问题,可能有机会在系统首选项中错过以下选项->网络->以太网->选择高级->代理

添加下面这行,

* .local,本地主机

其他回答

在我的例子中,SDKROOT环境变量是错误的,它引用了旧版本的iPhoneOSxx.x.sdk。(也许这个问题会在重启后自动解决?)

您可以通过运行echo $SDKROOT来检查它是否是一个有效的路径。

我通过更新.bash_profile来修复它:

export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk

在我的例子中,问题是Xcode没有安装。

在Mac中:毕竟,你会得到这个问题,可能有机会在系统首选项中错过以下选项->网络->以太网->选择高级->代理

添加下面这行,

* .local,本地主机

对于那些像我一样在更新Xcode后带着这个问题来到这个页面,但位置设置没有问题的人来说,重新启动我的电脑就成功了。

查看这个链接(运行react-native run-ios发生错误?)似乎是命令行工具的位置有问题。

在Xcode中,选择Xcode菜单,然后首选项,然后位置选项卡。从下拉菜单中选择你的Xcode版本,然后退出Xcode。