DEV Community

Markus
Markus

Posted on

gyp: No Xcode or CLT version detected! πŸ‘ˆ I think I know why this happens

πŸ‘‰ Are you a user of Xcode CLT only, not the full Xcode?

πŸ‘‰ Have you run into the gyp: No Xcode or CLT version detected! error?

πŸ‘‰ Did you solve it by sudo rm -r -f /Library/Developer/CommandLineTools and then re-installing it with xcode-select --install, only to inexplicably run into the exact same error a while later?

Here's the kicker...

πŸ‘‰πŸ‘‰ Are you a user of a Node version manager like asdf or nvm? πŸ‘ˆπŸ‘ˆ

I've been in this position a number of times in the last few months and I could never understand why it kept cropping up. But I think I've discovered why I continually, and intermittently had this issue.

I was working on a few older projects using Node 8. I wrapped one up yesterday and moved to a new React project this morning and so I nvm use 12.15 and ran npm i

gyp: No Xcode or CLT version detected!

πŸ˜”

So I begrudgingly deleted Xcode CLT and re-installed and everything worked fine. And then it clicked.

I think xcode-select --install attaches itself to the node version you have installed at the time

So you fix the problem, and then, later on, run into it again when you switch to a different version of Node.

Haven't tested this thoroughly... who has the time. But would love to hear if this resonates with anyone else and maybe this is actually the case?

Top comments (3)

Collapse
 
ceoehis profile image
Celestine Ekoh-Ordan

I've noticed I run into this issue every time I update my MacOS.

Collapse
 
mizner profile image
Michael Mizner

I'm running into this issue all the time. No solution yet.

Collapse
 
iaremarkus profile image
Markus

Do you use nvm or asdf as described above? IE can you replicate my hypothesis here, that you install the CLI tools in one version of node, and then you run into GYP issues when you switch to another version?