by Sai gowtham

How to fix the Node gyp Error: No Xcode or CLT version detected

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.

  1. 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.

  1. Now, install the Xcode by running this command.
xcode-select --install

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.

xcode is installing

Once you are successfully installed, you can now download new npm packages without any (gyp) error messages.

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
45,614 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
130,921 students enrolled
48.5 hours of video content
View Course