最近在使用 npm install
的時候遇到一個問題,裝到一半會出現 gyp: No Xcode or CLT version detected!
會出現此問題是因為 node-gyp
沒有讀到 Xcode,那怎麼解決呢?
解決方法
重新安裝 command-line tools
方法一
尋找 command-line tools
先找到 command-line tools
的位置使用指令 xcode-select --print-path
尋找,預設位置 /Library/Developer/CommandLineTools
clarence ~ xcode-select --print-path /Library/Developer/CommandLineTools
移除 command-line tools
clarence ~ sudo rm -r -f /Library/Developer/CommandLineTools
重新安裝 command-line tools
clarence ~ xcode-select --install
方法二
直接移除 command-line tools
clarence ~ sudo rm -rf $(xcode-select -print-path)
重新安裝 command-line tools
clarence ~ xcode-select --install
結論
每次更新系統好像都會發生,暫時還沒找到更好的解決方法 QQ
《AWS CDK 完全學習手冊:打造雲端基礎架構程式碼 IaC》
第 12 屆 iT 邦幫忙鐵人賽 DevOps 組冠的《用 CDK 定 義 AWS 架構》
第 11 屆 iT 邦幫忙鐵人賽《LINE bot 好好玩 30 天玩轉 LINE API》
一個熱愛分享的雲端工程師!