首页 文章

从终端运行React Native App时出错(iOS)

提问于
浏览
236

我正在关注官方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运行应用程序时,一切正常 .

有什么建议?

10 回答

  • -2

    对于那些像我这样在更新Xcode后遇到此问题但没有位置设置问题的人,重新启动计算机就可以了 .

  • 4

    在我的情况下,问题是没有安装Xcode .

  • 8

    我有一个类似的问题 . 从Xcode>首选项>位置选择Xcode版本 - 命令行工具解决了问题!

  • 84

    默认情况下,安装 Xcode 命令行未选中后,打开 Xcode 并转到 Preferences >> Locations 并设置 Command Line Tools ...

    这对我有用 MAC High SierraXcode Version 9.3

    i 打开 iOS emulator ...

    你可以看到一个很酷的新iPhone模拟器,如下图所示:

  • 644

    对我来说,事实证明有一个iOS系统更新未决,要求重新启动计算机 . 重启并让更新完成解决了我的问题 .

  • 0

    在我的情况下,SDKROOT环境变量是错误的,它引用了旧版本的iPhoneOSxx.x.sdk . (也许这会在重启后自动解决?)

    您可以通过运行 echo $SDKROOT 并验证它是否是有效路径来进行检查 .

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

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

    您可能需要安装或设置 Xcode Command Line Tools 的位置 .

    通过命令行

    如果您下载了Xcode,则可以运行以下命令来设置路径:

    sudo xcode-select -s /Applications/Xcode.app
    

    如果尚未安装命令行工具,则可能需要先运行此命令:

    xcode-select --install
    

    在安装命令行工具之前,您可能需要接受Xcode许可证:

    sudo xcodebuild -license accept
    

    通过Xcode

    或者通过Xcode( Xcode > Preferences > Locations )调整 Command Line Tools 设置:

  • 8

    看看这个链接:https://github.com/facebook/react-native/issues/7965 . 它似乎是 Command line tools 的位置问题 .

    在Xcode中,选择Xcode菜单,然后选择Preferences,然后选择Locations选项卡 . 从下拉列表中选择您的Xcode版本并退出Xcode .

  • 2

    在我第一次安装之前,我必须接受XCode许可证才能运行它 . 您可以运行以下命令通过命令行获取许可证提示 . 你必须输入 agree 并确认 .

    sudo xcodebuild -license
    
  • 1

    问题是您的Xcode版本未在命令行工具上设置,要解决此问题,请打开Xcode>菜单>首选项>位置>这里为命令行工具选择您的Xcode版本,就是这样 .

相关问题