Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install fails on node-gyp rebuild with "gyp: No Xcode or CLT version detected!" #7

Closed
prasanthmaran1 opened this issue Jul 4, 2018 · 56 comments

Comments

@prasanthmaran1
Copy link

prasanthmaran1 commented Jul 4, 2018

error code

> ckmeans@1.0.1 install /Users/project/node_modules/ckmeans
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

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:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.0.0
gyp ERR! command "/usr/local/Cellar/node/8.1.3/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/project/node_modules/ckmeans
gyp ERR! node -v v7.0.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm WARN facilio@0.0.1 No repository field.
npm WARN facilio@0.0.1 No license field.
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/Cellar/node/8.1.3/bin/node" "/usr/local/bin/npm" "install" "--save" "d3-scale-cluster"
npm ERR! node v7.0.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! ckmeans@1.0.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ckmeans@1.0.1 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ckmeans package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ckmeans
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ckmeans
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/project/npm-debug.log
@schnerd
Copy link
Owner

schnerd commented Jul 4, 2018

@prasanthmaran1 this library contains a native addon for extra performance in node environments, what this means is that you should have a c compiler installed on your system. This is fairly common in the node ecosystem.

See instructions here: https://github.com/nodejs/node-gyp#on-macos

In most cases this is as easy as running xcode-select --install on your mac.

Let me know if that works.

@schnerd schnerd changed the title Cannot able to install npm d3-scale-cluster package Install fails on node-gyp rebuild with "gyp: No Xcode or CLT version detected!" Jul 4, 2018
@schnerd schnerd changed the title Install fails on node-gyp rebuild with "gyp: No Xcode or CLT version detected!" npm install fails on node-gyp rebuild with "gyp: No Xcode or CLT version detected!" Jul 4, 2018
@prasanthmaran1
Copy link
Author

Thanks @schnerd package installed successfully...

@gilbertomangones
Copy link

perfect work for me. using xcode-select --install on mac. Thank you.

@paul4156
Copy link

paul4156 commented Nov 7, 2019

I had to re-install the xcode tools for some weird reason...

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

That is listed in the bottom of the guide (https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md). So thank you!

@tinker-li
Copy link

I had to re-install the xcode tools for some weird reason...

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

That is listed in the bottom of the guide (https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md). So thank you!

I do as this, too.

@Fil
Copy link

Fil commented Nov 7, 2019

I wouldn't ever trust a sudo rm -rf $(smth) command. However, doing it it two steps solved the problem for me also:

> xcode-select -print-path
/Library/Developer/CommandLineTools
> sudo rm -rf /Library/Developer/CommandLineTools

@SK-CSE
Copy link

SK-CSE commented Nov 9, 2019

following step help me to resolve this issue on Mac Catalina OS

sudo rm -rf $(xcode-select -print-path)
xcode-select --install
/usr/sbin/pkgutil --packages | grep CL
sudo npm install -g node-gyp

@aerolalit
Copy link

I had to re-install the xcode tools for some weird reason...

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

That is listed in the bottom of the guide (https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md). So thank you!

This worked for me in MacOs catalina.

@wangxiaocuo
Copy link

I had to re-install the xcode tools for some weird reason...

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

That is listed in the bottom of the guide (https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md). So thank you!

Thank you !!! very much

@bengotow
Copy link

I hate that reinstalling the Xcode tools worked, but it did.

I bought a brand new MBP today and installed Xcode on it for the first time a few hours ago (and xcode-select reported the tools were already installed). Really have no idea why this is necessary. Thanks, internet friends 🙏

@NickPepper
Copy link

NickPepper commented Nov 27, 2019

It’s time for them to rename their X-code to XXX-code...
Thank you very much, SK-CSE !
/usr/sbin/pkgutil --packages | grep CL
resolves the issue on Catalina.

@nwittstruck
Copy link

If you don't want to re-install xcode, you can also point xcode-select to the existing installation:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Make sure to open xcode at least once after installation to accept the terms.

@goto1
Copy link

goto1 commented Dec 11, 2019

I had a similar issue with a different package:

node-gyp rebuild
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

Running on macOS Catalina 10.15.2, I tried:

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

Fixed it by running the following:

$ [sudo] xcode-select --reset

@thompcd
Copy link

thompcd commented Dec 18, 2019

I'm currently on Catalina, following the reinstall commands:

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

I use fish as a shell and it didn't like the $( ...) command. Just wanted to mention that to work around it quickly, I just went into the Vscode terminal window and in the shell dropdown choose 'select default shell', choose a new shell from the top list (I used bash), then hit the '+' to open a new bash console. Then I could follow the commands directly without wrecking my fish shell setup.

@kn100
Copy link

kn100 commented Dec 18, 2019

I'm currently on Catalina, following the reinstall commands:

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

I use fish as a shell and it didn't like the $( ...) command. Just wanted to mention that to work around it quickly, I just went into the Vscode terminal window and in the shell dropdown choose 'select default shell', choose a new shell from the top list (I used bash), then hit the '+' to open a new bash console. Then I could follow the commands directly without wrecking my fish shell setup.

In Fish just drop the dollar!

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

@tomboland-vocovo
Copy link

Please don't run rm -rf $(any command at all), ever!

Just run xcode-select -print-path, confirm the path, then sudo rm -rf that_path. What if the command errored and output a single / or the path to your home directory. Destruction would ensue! Fundamentally, the advice to reinstall xcode is good. Having to do it at all is not so good :/

@nikhilmisra63
Copy link

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

works for me

@Rakkoc
Copy link

Rakkoc commented Dec 24, 2019

I'm currently on Catalina, following the reinstall commands:

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

I use fish as a shell and it didn't like the $( ...) command. Just wanted to mention that to work around it quickly, I just went into the Vscode terminal window and in the shell dropdown choose 'select default shell', choose a new shell from the top list (I used bash), then hit the '+' to open a new bash console. Then I could follow the commands directly without wrecking my fish shell setup.

In Fish just drop the dollar!

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

thank you. thats solv my problem.

@douglasrcjames
Copy link

Looks like sudo xcode-select --reset fixed my issue without needing to reinstall Xcode entirely.

@ranasingh
Copy link

This fixed it for me:
First reset: sudo xcode-select -r
Then accept license: sudo xcodebuild -license

@Katalyst33
Copy link

I am having this error and nothing here has worked.

@IefCuynen
Copy link

I am having this error and nothing here has worked.

Had the same issue.
Even after

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

I got the message

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

Even sudo xcode-select --reset did not fix anything and basically I ended up with a partly uninstalled xcode so I couldn't reinstall xcode from the app store too.

I used https://nektony.com/mac-app-cleaner to fully uninstall xcode and reinstalled xcode again from the app store.
That worked out great.

Hope it helps to solve your problem too

@dazuaz
Copy link

dazuaz commented Jan 14, 2020

Avoid using this command ever
sudo rm -rf ..
For mac you can use something like trash installed with brew install trash
then use it for all your command line deletions! i.e.
trash (xcode-select -print-path)

@sumit0708
Copy link

Reinstalled by 'xcode-select --install' but still facing the issue.
What to do as am using latest MacOS Catalina 10.15.4

@SK-CSE
Copy link

SK-CSE commented Mar 30, 2020

following step help me to resolve this issue on Mac Catalina OS

sudo rm -rf $(xcode-select -print-path)
xcode-select --install
/usr/sbin/pkgutil --packages | grep CL
sudo npm install -g node-gyp

@sumit0708 have you tried these above steps ☝️

@nigilan
Copy link

nigilan commented Mar 31, 2020

Updating to macOS to latest version fixed this issue for me. macOS - 10.15.4 . Node - v12.16.1. npm - v6.13.4.

@sgentile
Copy link

Getting same,

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 '/'.

@davidcalhoun
Copy link

davidcalhoun commented Apr 3, 2020

I previously went through the steps to fix the issue via command line, but the exact same issue popped up again later. This time I installed via the Xcode interface, which takes you to https://developer.apple.com/download/more/?=for%20Xcode where you can download the latest tools under Command Line Tools for Xcode x.x. Fixed it for now, hopefully for good.

EDIT: It's happened again after updating Xcode. Looks like you just need to open Xcode, get prompted with "Install additional required components?", and click Install.

@mnishizawa
Copy link

following step help me to resolve this issue on Mac Catalina OS

sudo rm -rf $(xcode-select -print-path)
xcode-select --install
/usr/sbin/pkgutil --packages | grep CL
sudo npm install -g node-gyp

I tried uninstalling and reinstalling, that didn't work. The global node-gyp install made it work.

@nadnoslen
Copy link

This issue keeps coming up for me every so often; likely tied to minor upgrades to OS X. xcode-select --reset does not seem to ever work for me. I end up resorting to a fresh install of the command line tools:

trash $(xcode-select -print-path)
xcode-select --install
# wait ten minutes... (◔_◔)

Good luck all!

@sscoville-rbx
Copy link

sudo xcode-select --reset did the trick too

This is the only thing that fixes it for me.

@tr1s
Copy link

tr1s commented Apr 21, 2020

My xcode recently updated and I ran into this problem for the second time. Instead of re-installing which I did the first time, I ran sudo xcode-select -s /Applications/Xcode.app/Contents/Developer to point to the existing install location like @nwittstruck mentioned.

Worked perfect, thanks!

@sumantaparida
Copy link

perfect work for me. using xcode-select --install on mac. Thank you.

not work

@codeater7
Copy link

Time and again, I have to install x-code what is the main issue??

@wangxiaocuo
Copy link

wangxiaocuo commented May 13, 2020

I am having this error and nothing here has worked.

Had the same issue.
Even after

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

I got the message

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

Even sudo xcode-select --reset did not fix anything and basically I ended up with a partly uninstalled xcode so I couldn't reinstall xcode from the app store too.

I used https://nektony.com/mac-app-cleaner to fully uninstall xcode and reinstalled xcode again from the app store.
That worked out great.

Hope it helps to solve your problem too

Sometimes it works, sometimes it doesn't.
So I suggest you use yarn to avoid the pain.
Or you can choose to use less instead of SCSS.

@gschema
Copy link

gschema commented May 18, 2020

@prasanthmaran1 hey mate, can you add this link:

The solution for the node-gyp problem/error on macOS Catalina "No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'."

In similar fashion like @joe-nano did at the top of his initial post here:

nodejs/node-gyp#1927

My issue background:

On my machine node-gyp got broken totally randomly and have no idea what to connect that break/corruption to. The system works perfectly fine and has 0 issues. After a restart it got reported as broken after running yarn. It was installed and present in the system but installation was corrupted for some reason. Interesting.

@atipugin
Copy link

atipugin commented Jun 3, 2020

Second time a row Catalina updates (10.15, 10.15.1) break CLT. Removing existing dir and re-installing CLT works, but it's pretty annoying.

@bohehe
Copy link

bohehe commented Jun 19, 2020

I had to re-install the xcode tools for some weird reason...

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

That is listed in the bottom of the guide (https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md). So thank you!

Save my life, thank you!

@omjha1505
Copy link

https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md. : this works for me. thanks

@m-a-r-c-e-l-i-n-o
Copy link

Only thing that worked for me was a comment by inglkruiz on here: nodejs/node-gyp#1927

@Tony-S201
Copy link

If you have a server response problem after xcode-select --install command.

Download the Command Line Tools for Xcode directly from https://developer.apple.com/download/more/

@kaiwoods
Copy link

I've fixed this by forcing npm to use a later version of node-gyp (at least version 7).

  1. Install node-gyp globally npm install -g node-gyp
  2. Confirm you're on a version 7 or higher node-gyp -v
  3. Get the path to the script which node-gyp
  4. Update npm config to use this version of node-gyp npm config set node_gyp /path/from/previous/step

This is hopefully a more permanent solution than always needing to re-install xcode-select tools. Unfortunately that is something I've found myself having to do time and time again.

The only gotcha is that, in my case (using nvm to manage my node version), when I update node, I'll have to update this config again. Still, I'd rather that than reinstall xcode-select every time.

Working good for me so far; YMMV.

@nadnoslen
Copy link

nadnoslen commented Dec 4, 2020

Thanks @kaiwoods. I use asdf and bump into this as I dance around projects with different versions of node. For my asdf world I needed to asdf which node-gyp to fetch the proper node-gyp path (regular which will give you the asdf shim). Hope that helps asdf users. And seriously, thanks @kaiwoods!!!

@AlexeySmolyaninov
Copy link

AlexeySmolyaninov commented Dec 8, 2020

I have had an old node version after I have updated it to a new stable one it fixed my problem.

@Pearel-Skillate
Copy link

following step help me to resolve this issue on Mac Catalina OS

sudo rm -rf $(xcode-select -print-path)
xcode-select --install
/usr/sbin/pkgutil --packages | grep CL
sudo npm install -g node-gyp

This worked perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests