`npm install` fails on node-gyp rebuild with `gyp: No Xcode or CLT version detected!`
Even though you have them installed (my case), but by upgrading to Catalina (10.15.*) you can get this error (my case :) ).
Therefore, simply installing wouldn't help as you will get an error that they are already installed.
Therefore you need to uninstall and install (requires large redownload) them again:
xcode-select --print-path
# in my case /Library/Developer/CommandLineTools
# the next line deletes the path returned by the command above
sudo rm -rf $(xcode-select --print-path)
# install them (again) if you don't get a default installation prompt
xcode-select --install
NOTE:
- You do not need to do it per project, but only once
- There was also discussion that you have to do it on every OSX update, in my case, later updating the OSX system didn't trigger this issue again
Credits to: gyp: No Xcode or CLT version detected macOS Catalina
This worked for me with macOS Catalina Version 10.15.5:
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
$ sudo xcode-select --switch /Library/Developer/CommandLineTools
...
$ sudo xcode-select --reset
...
The xcode cli tools should now be accessible. No need to re-install anything.
Try these commands:
sudo rm -rf $(xcode-select -print-path)
xcode-select --install