Vue学习笔记之gyp: No Xcode or CLT version detected! gyp ERR! stack Error: `gyp` failed with exit code: 1

发布时间 2023-06-08 18:36:07作者: 时光飞逝,逝者如斯

0x00 现象

MacOS在执行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
.............

以上一堆报错日志基本是说xcode有问题,按常理说xcode是Mac自带的环境不会有大问题;

但是就出在xcode这里,该问题一般出现在系统升级之后,系统的小版本迭代升级,也会触发这个报错;

 

0x01 解决方法

在命令行内重新安装xcode,记得在弹出服务条款时点击“同意”;

xcode-select --install

或者去appStore内重新安装xcode。

 

0x02 参考

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