In this tutorial, we will learn how to solve the node gyp Error: No Xcode or clt version detected in mac os.
When you update a node.js or npm to the latest version and you are trying to install a new npm package using
npm install package-name command you will see the weird error like this in your terminal.
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:343:16) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12) gyp ERR! System Darwin 14.0.0 gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/local/lib/node_modules/gulp/node_modules/fsevents gyp ERR! node -v v13.10.33 gyp ERR! node-gyp -v v5.0.7 gyp ERR! not ok
To fix this error, you need to re-install the Xcode command-line tools.
- First, delete the Xcode tools by using the below command.
sudo rm -rf $(xcode-select -print-path)
This above command asks for a system password.
- Now, install the Xcode by running this command.
This command prompts with a popup, click on the
install button and proceed with the installation.
It takes some time to download and install the Xcode command-line tools.
Once you are successfully installed, you can now download new npm packages without any (gyp) error messages.