【问题标题】:How to fix node gyp error caused by new macos catalina update如何修复新的 macOS Catalina 更新导致的节点 gyp 错误
【发布时间】:2020-04-18 08:30:41
【问题描述】:

在 node-gyp 开始抱怨说之后,我将我的 mac 操作系统更新为 catalina 10.15.4

gyp:未检测到 Xcode 或 CLT 版本!

我该如何解决这个问题?

【问题讨论】:

    标签: node.js xcode macos-catalina node-gyp


    【解决方案1】:

    我不知道发生了什么,但我做了跟踪,它又开始工作了

    删除命令行工具

    sudo rm -r -f /Library/Developer/CommandLineTools

    然后重新安装

    xcode-select --install

    希望对遇到和我一样问题的人有所帮助

    【讨论】:

    • 可以通过xcode-select --print-path找到安装的命令行工具的路径
    【解决方案2】:

    我想,到目前为止,您可能已经尝试了多种解决方案,但如果这些解决方案都没有为您工作,请不要担心 - 我知道了。 :)

    无效的解决方案:

    1. xcode-select --install 对我不起作用(macOS Catalina 10.15.7),因为它显示了一个软件更新对话框,上面写着Can't install the software because it is currently not available from the Software Update Server
    2. 我还从 Apple 的下载网站 (https://developer.apple.com/download/more/?=for%20Xcode) 下载并安装了 Xcode 命令行工具,但问题以某种方式再次出现,或者可能是它没有首先解决它,我不知何故没有注意到。李>
    3. sudo xcode-select --reset 也没有帮到我。

    工作解决方案:

    这对我有用,即手动使用软件更新重新安装 Xcode 命令行工具。

    1. 使用以下命令检查要更新的软件列表中是否提到了命令行工具更新:softwareupdate -l
    2. 如果该列表中未提及命令行工具更新,则使用以下命令手动使其成为列表的一部分,该命令将创建一个临时文件:sudo touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
    3. 再次运行softwareupdate -l,验证列表现在是否包含提到的命令行工具。
    4. 现在,按 Cmd+Space 启动 Mac 的 Spotlight 搜索。搜索Software Update。启动Software Update
    5. 这将显示以下用于安装命令行工具的对话框。安装更新并快乐。 :)
    6. 删除步骤 2 中创建的临时文件:sudo rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress

    【讨论】:

      猜你喜欢
      • 2021-09-24
      • 2021-12-01
      • 1970-01-01
      • 2020-02-06
      • 1970-01-01
      • 1970-01-01
      • 2021-02-13
      • 1970-01-01
      • 2013-06-12
      相关资源
      最近更新 更多