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

前端 未结 13 1492
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 12:56

Every time I try npm install. I get the following error. How do I fix it?

gyp: No Xcode or CLT version detected!

I am on n

相关标签:
13条回答
  • 2020-12-07 13:13

    Try these commands:

    sudo rm -rf $(xcode-select -print-path)
    
    xcode-select --install
    
    0 讨论(0)
  • 2020-12-07 13:19

    I guess, you may have tried multiple solutions so far but if none of those solutions have worked for you yet, don't worry - I got you. :)

    Non-working Solutions:

    1. xcode-select --install didn't work for me (macOS Catalina 10.15.7) as it shows up a Software Update dialog box which says Can't install the software because it is currently not available from the Software Update Server.
    2. I also downloaded and install Xcode Command Line Tools from Apple's download website (https://developer.apple.com/download/more/?=for%20Xcode) but the problem re-appeared somehow or may be it didn't solve it in first place and I somehow didn't notice.
    3. sudo xcode-select --reset also didn't do the trick for me.
    4. Someone suggested to install whole XCode. No, thank you.

    Working Solution:

    Here is what worked for me i.e. reinstall Xcode Command Line Tools using Software Update manually.

    1. Check if Command Line Tools Update is mentioned in your list of softwares to be updated by using following command: softwareupdate -l
    2. If Command Line Tools Update is not mentioned in that list, then manually make it part of the list using following command which will create a temporary file: sudo touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
    3. Verify that the list now has the Command Line Tools mentioned by running softwareupdate -l again.
    4. Now, press Cmd+Space to initiate Mac's Spotlight Search. Search for Software Update. Start the Software Update.
    5. That will show you following kind of dialog for installing the Command Line Tools. Install away the update and be merry. :)
    6. Remove the temporary file created in Step 2: sudo rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress.
    0 讨论(0)
  • 2020-12-07 13:23

    on catalina had to manually install command line tools for xcode from https://developer.apple.com/download/more/

    0 讨论(0)
  • 2020-12-07 13:24

    Even though you have them installed (my case), but by upgrading to Catalina (10.15.*) you can get this error (my case :) ).

    Therefore, simply installing wouldn't help as you will get an error that they are already installed.

    Therefore you need to uninstall and install them again:

    xcode-select --print-path
    # in my case /Library/Developer/CommandLineTools
    
    # the next line deletes the path returned by the command above
    sudo rm -rf $(xcode-select --print-path)
    
    # install them (again) if you don't get a default installation prompt
    xcode-select --install
    

    NOTE:

    • You do not need to do it per project, but only once
    • There was also discussion that you have to do it on every OSX update, in my case, later updating the OSX system didn't trigger this issue again

    Credits to: gyp: No Xcode or CLT version detected macOS Catalina

    0 讨论(0)
  • 2020-12-07 13:25

    you will need to install xcode or command line tools

    0 讨论(0)
  • 2020-12-07 13:25

    On macOS Catalina:

    1. Uninstall "Command Line Tools for Xcode" with command sudo rm -rf $(xcode-select --print-path);
    2. Download "Command Line Tools for Xcode" at More Downloads for Apple Developers, then install it.
    0 讨论(0)
提交回复
热议问题