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! 報錯