The problem

MacOS Catalina: NPM installation:


> 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/yangjian/Documents/temp/test001/node_modules/fsevents gyp ERR! Node -v v12.13.0 gyp ERR! Node-gop-v v5.0.5 gyp ERR! not okCopy the code
  • The screenshot below

The solution

1. Run the following command to rectify the fault

$ xcode-select --install
Copy the code

The following information is displayed:

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

There is no such thing as a “Software Update”

2. Correct posture

At a loss what to do, find the following solutions:

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

Please refer to:

  • Github.com/schnerd/d3-…
  • Github.com/nodejs/node…