在运行npm安装时看到以下错误,需要node-gyp…但可以被任何需要xcode-select的东西触发。

xcodebuild工具需要Xcode,但是是活动的 开发者目录'/Library/ developer /CommandLineTools'是一个命令 直线工具实例

有什么问题吗?


当前回答

我得先运行这个

sudo xcode-select --reset

then

sudo xcode-select -switch /Library/Developer/CommandLineTools

然后就成功了。

其他回答

对于那些不想安装Xcode的人,还有其他解决方案:

安装命令行工具(如果你还没有): xcode-select——安装 修改主目录: sudo xcode-select -switch /Library/Developer/CommandLineTools

这对我很管用(git)。

我得先运行这个

sudo xcode-select --reset

then

sudo xcode-select -switch /Library/Developer/CommandLineTools

然后就成功了。

今天是2019年1月28日。

在我的Mac上,我做了两件事来解决这个问题:

在终端运行如下命令: Sudo xcode-select——install 重启你的Mac。

直到我重新启动电脑,我的Android Studio一直出现这个问题。重启后,它工作得很好。还要注意,我没有像其他人那样执行任何——switch命令。我希望这能有所帮助。

手动安装Command LineTool对我来说很有效。

我在App Store中暂停了xcode 仍然无法下载Homebrew 我通过链接手动安装命令行工具。 砰砰砰

https://developer.apple.com/download/more/?=command%20line%20tools

在你的终端中输入这个

xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept