When trying to run npm install after setting up a new laravel project, I got these error message:
sebastian@Sebastians-iMac my-project % npm install > email@example.com install /Users/sebastian/Development/valet/my-project/node_modules/fsevents > 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:344: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.2.0 gyp ERR! command "/usr/local/Cellar/node/12.12.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/sebastian/Development/valet/my-project/node_modules/fsevents gyp ERR! node -v v12.12.0 gyp ERR! node-gyp -v v5.0.3 gyp ERR! not ok npm WARN optional SKIPPING OPTIONAL DEPENDENCY: firstname.lastname@example.org (node_modules/fsevents): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: email@example.com install: `node-gyp rebuild` npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1 added 1005 packages from 484 contributors and audited 17215 packages in 11.75s found 0 vulnerabilities
Solution was, to remove the XCode Command Line Tools by running this command:
sudo rm -r -f /Library/Developer/CommandLineTools
Here you can find the official documentation.
After removing the Command Line Tools, I had to setup them again by running:
Next try to run npm install was a success.