本文共 2918 字,大约阅读时间需要 9 分钟。
本文翻译自:
Saw the following error when running an npm install
which required node-gyp
... but could be triggered by anything which requires xcode-select
. 运行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-select:错误:工具'xcodebuild'需要Xcode,但是活动的开发人员目录'/ Library / Developer / CommandLineTools'是命令行工具实例
What is the problem? 问题是什么?
参考:
This problem happens when xcode-select
developer directory was pointing to /Library/Developer/CommandLineTools
, when a full regular Xcode was required (happens when CommandLineTools are installed after Xcode) 当xcode-select
开发人员目录指向/Library/Developer/CommandLineTools
时,需要完整的常规Xcode(在Xcode之后安装/Library/Developer/CommandLineTools
时发生),就会发生此问题。
Solution: 解:
/Applications
directory (NOT /Users/{user}/Applications
). 确保Xcode应用程序位于/Applications
目录中(不是/Users/{user}/Applications
)。 xcode-select
to the Xcode app Developer directory using the following command: 使用以下命令将xcode-select
指向Xcode app Developer目录: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Note: Make sure your Xcode app path is correct. 注意:确保您的Xcode应用程序路径正确。
/Applications/Xcode.app/Contents/Developer
Xcode: /Applications/Xcode.app/Contents/Developer
/Applications/Xcode-beta.app/Contents/Developer
Xcode-beta: /Applications/Xcode-beta.app/Contents/Developer
Other solution for those who don't want to install Xcode: 对于那些不想安装Xcode的人的其他解决方案:
Install Command Line Tools (if you haven't already): 安装命令行工具(如果尚未安装):
xcode-select --install
Change the active directory: 更改活动目录:
sudo xcode-select -switch /Library/Developer/CommandLineTools
This worked for me (git). 这对我有用(git)。
Install Xcode from App Store. 从App Store安装Xcode。 After installing run xcodebuild with root privileges ie sudo xcodebuild
and accept the language. 安装后,以root权限(即sudo xcodebuild
运行xcodebuild并接受该语言。 After this npm install bcrypt
worked like a charm! 在此npm install bcrypt
就像一个魅力一样npm install bcrypt
了作用!
I was having an issue while trying to install packages using npm. 尝试使用npm安装软件包时遇到问题。 I got the error: "sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/" 我收到错误:“ sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/”
To fix this 要解决这个问题
Now when installing packages with npm I no longer get errors. 现在,当使用npm安装软件包时,不再出现错误。
Without Xcode: create file /usr/local/bin/xcodebuild
with content to cheat XcodeSelect 如果没有Xcode:创建文件/usr/local/bin/xcodebuild
并包含内容以欺骗XcodeSelect
#!/bin/bash exit 0
chmod +x /usr/local/bin/xcodebuild
转载地址:http://pncnb.baihongyu.com/