node-gyp: node-gyp rebuild not working on MacOS Catalina Beta without reinstalling CommandLineTools

  • Node Version: v8.16.1 & v12.7.0
  • Platform: Darwin macbook 19.0.0 Darwin Kernel Version 19.0.0: Tue Jul 23 01:19:36 PDT 2019; root:xnu-6153.0.103.151.1~4/RELEASE_X86_64 x86_64
  • Compiler: Apple clang version 11.0.0 (clang-1100.0.33.5) Target: x86_64-apple-darwin19.0.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  • Module: any module…
Verbose output (from npm or node-gyp):
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!

Yes, I know, it’s obvious that there are some bugs on a beta OS, but I just wanted to share the solution because I couldn’t find anything by googling.

To run node-gyp, you need to do this: xcode-select --install first, but if you already installed the command line tools in the past, this command will just output:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

Using “Software Update” as suggested, won’t fix this problem. You have to uninstall the command line tools first by deleting this folder: /Library/Developer/CommandLineTools reference

After doing that, you need to run xcode-select --install again and everything should work now.

However, even though node-gyp now finds your command line tools, it will still fail if you use a node version higher than v8.16.1, so consider downgrading to that momentarily (by using nvm for example…).

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 33
  • Comments: 29 (9 by maintainers)

Commits related to this issue

Most upvoted comments

how I managed to solve the problem:

  1. install xcode-select (sudo xcode-select --install)
  2. execute xcode-select -print-path, it will display something like /Library/Developer/CommandLineTools
  3. execute sudo xcode-select --reset it should change the path to /Applications/Xcode.app/Contents/Developer
  4. rejoice that everything worked 😃

As @NickNaso is writing reinstalling worked for me as the only option - whatever sudo xcode-select --reset solutions didn’t.

So based on: https://developer.apple.com/library/archive/technotes/tn2339/_index.html#//apple_ref/doc/uid/DTS40014588-CH1-HOW_CAN_I_UNINSTALL_THE_COMMAND_LINE_TOOLS_

  1. I run sudo rm -rf /Library/Developer/CommandLineTools
  2. and then xcode-select --install

after that problem was gone and I could compile everything that has been dying on node-gyp relation…

After upgrading to Catalina, downgrading to node v8.16.1 solved my problem. Thanks!

I suggest reopening this issue tho. It’s not resolved and I kinda feel like, yeah, OSX is weird and stuff, but this is still an issue with node-gyp itself. I use several other tools and programs depending on the command line tools that don’t require me to delete and reinstall them almsot every time I use aforesaid tools and programs.

Maybe it correlates with OSX updates, I personally think it correlates more with node.js updates or switches (nvm). Either way, reinstalling command line tools every time is not a solution, it’s a workaround.

I hope this gets fixed.

https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md

Yes, I’ve followed those instructions several times.

It seems like every few months node-gyp stops working and the only way to fix it is to remove the Xcode tools, reinstall them, rm -rf node_modules and npm install them again.

OS X problems…

@cclauss Oh, sorry, thanks. Alright, good to know the status about that, but as I said, just wanted to share the current “workaround” in my issue until Catalina is released.

Why does it seem like I have to revisit this issue every few months? Is there no consistent way to have this just work?

I solve with sudo npm install --unsafe-perm flag ... where … could be any module

Solution worked for me too. Thank you! 😃

I want report that re-installing the command line tools worked for me. Thanks.

Just had to do the remove/reinstall dance again. It definitely correlates with OS X OS updates.

Correct. I was still getting weird make build errors until I wiped and reinstalled node_modules.

Catalina is here, yay!

Second paragraph of https://github.com/nodejs/node-gyp/issues/1779#issuecomment-504267747

I also don’t think we’re going to be in a position to provide any support for Catalina until it’s actually released, we hardly have the people + bandwidth to deal with supported operating systems. Sorry.