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

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

有什么问题吗?


当前回答

简单的重新安装xcode-select

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

其他回答

我在尝试使用npm安装包时遇到了一个问题。 我得到了错误:“sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/”

要解决这个问题

我打开Xcode。 首选项 位置 选择命令林工具:Xcode 6.1.1

现在当用npm安装包时,我不再会得到错误。

如果你使用的是Xcode测试版,运行

sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer 

而不是

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

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

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

这对我很管用(git)。

只需要两个步骤,和完整的XCode。App根本不需要:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

此时弹出“Installing software”对话框:

就是这样!

从App Store下载Xcode。 进入Xcode首选项/位置/CommandlineTools 你只需要设置成Xcode版本。它自动指向" /Application/ xcode。app "