Every time I try
npm install. I get the following error. How do I fix it?
gyp: No Xcode or CLT version detected!
I am on
node -v → v8.8.0 &
npm -v → v6.11.3
I tried to run it on VSCode terminal and iTerm, but both ended up getting the same error. (both are updated to the latest version). The only new thing I did is updating my macOS to the latest version (Catalina 10.15.3 today).
$ npm install Fri Mar 6 17:22:40 2020 > email@example.com install /Users/synapse/Documents/synapsefi-dev-ui/node_modules/watchpack/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 (/Users/synapse/.nvm/versions/node/v8.8.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:344:16) gyp ERR! stack at emitTwo (events.js:125:13) gyp ERR! stack at ChildProcess.emit (events.js:213:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Darwin 19.3.0 gyp ERR! command "/Users/synapse/.nvm/versions/node/v8.8.0/bin/node" "/Users/synapse/.nvm/versions/node/v8.8.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/synapse/Documents/synapsefi-dev-ui/node_modules/watchpack/node_modules/fsevents gyp ERR! node -v v8.8.0 gyp ERR! node-gyp -v v5.0.3 gyp ERR! not ok npm WARN firstname.lastname@example.org No repository field. npm WARN The package country-data is included as both a dev and production dependency. npm WARN The package react-dropzone is included as both a dev and production dependency. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: email@example.com (node_modules/watchpack/node_modules/fsevents): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: firstname.lastname@example.org install: `node-gyp rebuild` npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
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
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.
I guess, you may have tried multiple solutions so far but if none of those solutions have worked for you yet, don't worry - I got you. :)
xcode-select --installdidn't work for me (macOS Catalina 10.15.7) as it shows up a Software Update dialog box which says
Can't install the software because it is currently not available from the Software Update Server.
sudo xcode-select --resetalso didn't do the trick for me.
Here is what worked for me i.e. reinstall Xcode Command Line Tools using Software Update manually.
sudo touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
Software Update. Start the
sudo rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress.