在运行npm安装时看到以下错误,需要node-gyp…但可以被任何需要xcode-select的东西触发。
xcodebuild工具需要Xcode,但是是活动的 开发者目录'/Library/ developer /CommandLineTools'是一个命令 直线工具实例
有什么问题吗?
在运行npm安装时看到以下错误,需要node-gyp…但可以被任何需要xcode-select的东西触发。
xcodebuild工具需要Xcode,但是是活动的 开发者目录'/Library/ developer /CommandLineTools'是一个命令 直线工具实例
有什么问题吗?
当前回答
以上这些方法对我都没用。我最初单独安装了命令行工具,然后是所有的Xcode。对我有用的是卸载如下所示的命令行工具。然后,当再次尝试运行xcode-select时,我被要求重新安装它们。
*顺便说一下,我发现这个线程的原因是因为我用macports安装了一些库(特别是gcc),大概是用旧的命令行工具,然后我在开发中途安装了完整的Xcode。所以无论如何,对于我的情况,我必须在删除独立的命令行工具后重新安装macports,重新安装它们,重新安装gcc,然后我的编译工作。
其他回答
我在高海拔地区也遇到了同样的问题。 运行下面的命令可以解决这个问题
npm explore npm -g -- npm install node-gyp@latest
如果你已经安装了XCode,你所要做的就是…
打开XCode 去Xcode >首选项>位置 从命令行工具选择你的XCode
sudo xcode-select -s /Applications/Xcode 10.app/Contents/Developer
languoguangs-iMac:/ languoguang$ sudo xcode-select -s /Applications/Xcode 10.app/Contents/Developer
xcode-select: error: invalid argument '10.app/Contents/Developer'
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
-h, --help print this help message and exit
-p, --print-path print the path of the active developer directory
-s <path>, --switch <path> set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path
languoguangs-iMac:/ languoguang$ sudo xcode-select -s "/Applications/Xcode 10.app/Contents/Developer"
因为我在应用程序中的Xcode名称是Xcode 10,
sudo xcode-select -s "/Applications/Xcode 10.app/Contents/Developer"
的工作原理。
当需要一个完整的常规Xcode时,Xcode -select developer目录指向/Library/ developer /CommandLineTools时发生此问题(当CommandLineTools安装在Xcode之后时发生)
解决方案:
如果你还没有Xcode,请安装它(从https://appstore.com/mac/apple/xcode获取)。 接受条款和条件。 确保Xcode app在/Applications目录下(不是/Users/{user}/Applications)。 使用以下命令将Xcode -select指向Xcode app Developer目录: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
注意:确保你的Xcode应用路径是正确的。
Xcode: / / Xcode /内容/应用开发者 Xcode-beta: / / Xcode-beta.app /内容/应用开发者
我只是运行了以下命令,问题为我解决了:
sudo xcode-select --reset