How to fix "gyp: No Xcode or CLT version detected!" error?


xcode cli mac

Hello! If you are from Ukraine, Belarus, Poland or India and looking for a job in Software Development, please reach me out by email.

This error occurs occasionally if you are working with Node packages on Mac OS:

gyp ERR! stack Error: `gyp` failed with exit code: 1

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:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "clean" "configure"
gyp ERR! cwd /Users/r.akhromieiev/Projects/project/node_modules/@newrelic/native-metrics
gyp ERR! node -v v10.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 

In this post, we will fix it.

Step 1

In the beginning, let’s make sure that we have updated our Mac OS system:

Updates Available

If you see a notification about updates, please install update Mac OS and restart the system if it is required:

Updates Available

In my case that was the solution to this issue. If it doesn’t help you, proceed to the following steps.

Step 2

You need to get the location of XCode CLI and then remove it.

You can get it by the following command.

xcode-select --print-path

If you want to get the location and remove it by a single command, you can use this command:

sudo rm -rf $(xcode-select --print-path)

Step 3

Now we can re-install command line developer tools. We may need xcode-select --install command for this:

xcode-select-install

Also, you will be prompted by the installation window. Press Install.

Conclusion

After successfully installation an error gyp: No Xcode or CLT version detected! will go away.

comments powered by Disqus