gyp: No Xcode or CLT version detected!

最近升级了系统之后,做 npm install 操作时会报错如下

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:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:203:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/hliang/Documents/wwwroot/tbw.ixcv.com/vuebackend/node_modules/fsevents
gyp ERR! node -v v12.7.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok

解决方式如下:

$ sudo rm -rf $(xcode-select -print-path)
$ xcode-select --install

发表评论

电子邮件地址不会被公开。 必填项已用*标注