gyp: No Xcode or CLT version detected 在 macOS Catalina 错误解决办法

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 19.4.0

创建vue项目报错,Mac报如上错误,解决步骤:

1.通过运行以下命令来获取已安装的命令行工具的位置

xcode-select --print-path

如下

2.通过以下命令将这个位置路径删除掉

sudo rm -rf /Library/Developer/CommandLineTools

如下:

3.执行以下命令进行重新安装

xcode-select --install

点击安装即可

安装完成

猜你喜欢

转载自www.cnblogs.com/zhaohui-116/p/12801904.html