Mac 执行 npm install 时报错 gyp: No Xcode or CLT version detected!
image解决:
$ sudo xcode-select --install
如果提示:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
查看一下路径:
$ xcode-select --print-path
返回:
/Library/Developer/CommandLineTools
把这个目录删除:
$ sudo rm -rf /Library/Developer/CommandLineTools
记得使用
sudo
,否则此目录下的每个文件都会提示一下没有权限Permission denied
例如:
rm: /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/cachecontrol/pycache/init.cpython-37.pyc: Permission denied
删除后再次执行:
$ sudo xcode-select --install
会弹出一个安装窗口,等待几分钟安装完成即可。
网友评论