运行 npm install
时出现以下错误需要node-gyp
...但可能被任何需要xcode-select
的东西触发.
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
问题是什么?
最佳答案
当需要完整的常规 Xcode 时,当 xcode-select
开发人员目录指向 /Library/Developer/CommandLineTools
时,会发生此问题(在 Xcode 之后安装 CommandLineTools 时会发生此问题) )
解决方案:
- 如果您还没有安装 Xcode(从 https://appstore.com/mac/apple/xcode 获取),请安装它。
- 接受条款及条件。
- 确保 Xcode 应用位于
/Applications
目录中(而不是/Users/{user}/Applications
)。 - 使用以下命令将
xcode-select
指向 Xcode 应用程序 Developer 目录:
sudo xcode-select -s/Applications/Xcode.app/Contents/Developer
注意:确保您的 Xcode 应用路径正确。
- Xcode:
/Applications/Xcode.app/Contents/Developer
- Xcode-beta:
/Applications/Xcode-beta.app/Contents/Developer
关于xcode-选择事件开发人员目录错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17980759/