Gyp: no Xcode or CLT version detected!

Questions

Recently, when NPM installation module is used in MacOS Catalina, the following errors often occur:


> node-gyp rebuild

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
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:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.3.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/xxxx/Documents/temp/test001/node_modules/fsevents
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 

The screenshot is as follows

Solutions

1. Try to repair with the following command

$ xcode-select --install

The system prompts the following information:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

In fact, there is no so-called “software update” to update

2. Correct posture

At a loss, we found the following solutions:

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

Please:

https://github.com/schnerd/d3-scale-cluster/issues/7

https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md

Similar Posts: