`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 hopefully just (I) reset the tool or in worse case (II) uninstall and install (requires large redownload) it again (this is based on the @Dane_duPlessis’s answer).

# just for а preview (not necessary)
xcode-select --print-path
# in my case it printed `/Library/Developer/CommandLineTools`

# could be useful if the path is making a problem
sudo xcode-select --switch /Library/Developer/CommandLineTools

# only for the (I) resetting case
sudo xcode-select --reset

# only for the (II) uninstalling case - the next line deletes folder returned by the `xcode-select --print-path` command
sudo rm -rf $(xcode-select --print-path)


# only for the (II) uninstalling case - install tools (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

Leave a Comment