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

本文翻译自:Error Running React Native App From Terminal (iOS)

I am following the tutorial on the official React Native website. 我正在关注官方React Native网站上的教程。

Using the following to build my project: 使用以下代码构建我的项目:

react-native run-ios

I get the error: 我收到错误:

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

Although, when I run the app from the .xcodeproj, everything works fine. 虽然,当我从.xcodeproj运行应用程序时,一切正常。

Any suggestions? 有什么建议?


#1楼

参考:https://stackoom.com/question/2guER/从终端运行React-Native-App时出错-iOS


#2楼

Check out this link ( Running react-native run-ios occurs an error? ). 看看这个链接( 运行react-native run-ios会出错吗? )。 It appears to be a problem with the location of Command line tools . 它似乎是Command line tools的位置问题。

In Xcode, select Xcode menu, then Preferences, then Locations tab. 在Xcode中,选择Xcode菜单,然后选择Preferences,然后选择Locations选项卡。 Select your Xcode version from the dropdown and exit Xcode. 从下拉列表中选择您的Xcode版本并退出Xcode。

XCode位置选项卡


#3楼

You may need to install or set the location of the Xcode Command Line Tools . 您可能需要安装或设置Xcode命令行工具的位置。

Via command line 通过命令行

If you have Xcode downloaded you can run the following to set the path: 如果您下载了Xcode,则可以运行以下命令来设置路径:

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

If the command line tools haven't been installed yet, you may need to run this first: 如果尚未安装命令行工具,则可能需要先运行此命令:

xcode-select --install

You may need to accept the Xcode license before installing command line tools: 在安装命令行工具之前,您可能需要接受Xcode许可证:

sudo xcodebuild -license accept 

Via Xcode 通过Xcode

Or adjust the Command Line Tools setting via Xcode ( Xcode > Preferences > Locations ): 或者通过Xcode( Xcode > Preferences > Locations )调整Command Line Tools设置:

Xcode首选项 - 位置选项卡


#4楼

I had to accept the XCode license after my first install before I could run it. 在我第一次安装之前,我必须接受XCode许可证才能运行它。 You can run the following to get the license prompt via command line. 您可以运行以下命令通过命令行获取许可证提示。 You have to type agree and confirm as well. 你必须输入agree并确认。

sudo xcodebuild -license

#5楼

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


#6楼

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值