Mac 解决 gyp: No Xcode or CLT version detected! 报错

在执行npm install下载项目的依赖包的时候出现的gyp报错,报错内容如下:

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1

解决方案:
删除已经安装的CommandLineTools

$ sudo rm -rf $(xcode-select -p)

2.重新安装

$ sudo xcode-select --install

同意条款选择同意,会提示系统更新一并同意。
用这个方法可以避免下载庞大的Xcode
原文链接

发布了2 篇原创文章 · 获赞 3 · 访问量 51

猜你喜欢

转载自blog.csdn.net/inorilin/article/details/105467114