简体   繁体   English

macOS Big Sur:当我运行 `npm install` 时,在 `node-gyp rebuild` 步骤中出现错误:`gyp:未检测到 Xcode 或 CLT 版本!`

[英]macOS Big Sur: When I run `npm install`, I get an error during the step `node-gyp rebuild`: `gyp: No Xcode or CLT version detected!`

On macOS Big Sur, with node v14.17.1, when I run npm install (for the package jq )在 macOS Big Sur 上,节点 v14.17.1,当我运行npm install (对于包jq
then I get the error (during the installation of the dependent node_module contextify ):然后我收到错误(在安装依赖 node_module contextify ):

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!

Note that I already installed the Xcode command-line tools.请注意,我已经安装了 Xcode 命令行工具。 xcode-select --install displays: xcode-select --install显示:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates xcode-select: 错误:命令行工具已经安装,使用“软件更新”安装更新

and no possible update appears in "Software Update".并且“软件更新”中没有出现可能的更新。

Note: Unsure if that's related, but my Mac had an OS update earlier today...注意:不确定这是否相关,但我的 Mac 今天早些时候进行了操作系统更新......

The repository node-gyp contains a dedicated troubleshooting guide for macOS Catalina:存储库node-gyp包含专门针对 macOS Catalina 的故障排除指南:

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

Apparently, it still applies also for macOS Big Sur 🧐显然,它仍然适用于 macOS Big Sur 🧐

TLDR:域名注册地址:

Installation notes for macOS Catalina (v10.15) macOS Catalina (v10.15) 安装说明

Both upgrading to macOS Catalina and running a Software Update in Catalina may cause normal node-gyp installations to fail.升级到 macOS Catalina 和在 Catalina 中运行软件更新都可能导致正常的node-gyp安装失败。 This might manifest as the following error during npm install :这可能会在npm install期间表现为以下错误:

gyp: No Xcode or CLT version detected!

Solutions解决方案

There are three ways to install the Xcode libraries node-gyp needs on macOS.在 macOS 上安装node-gyp需要的 Xcode 库有三种方法。 People running Catalina have had success with some but not others in a way that has been unpredictable.经营 Catalina 的人以一种不可预测的方式在某些方面取得了成功,但在其他方面却没有成功。

  • With the full Xcode (~7.6 GB download) from the App Store app.使用来自 App Store 应用程序的完整 Xcode(约 7.6 GB 下载)。
  • With the much smaller Xcode Command Line Tools via xcode-select --install通过xcode-select --install使用更小的 Xcode 命令行工具
  • With the much smaller Xcode Command Line Tools via manual download.通过手动下载使用更小的 Xcode 命令行工具。

This "solved" it for me:这为我“解决”了它:

Download the current Command Line Tools for Xcode from the Apple Developer webpage: https://developer.apple.com/download/all/?q=command从 Apple Developer 网页下载适用于 Xcode的当前命令行工具https : //developer.apple.com/download/all/? q = command

(Currently: Command Line Tools for Xcode 12.5.1, installer size 483 MB, requires 2.7 GB disk space) (当前:Xcode 12.5.1 的命令行工具,安装程序大小 483 MB,需要 2.7 GB 磁盘空间)

Though I get further build errors during node-gyp rebuild now... (for the package contextify) - but that's something that probably should be addressed separately.虽然我现在在node-gyp rebuild过程中遇到了进一步的构建错误......(对于包 contextify) - 但这可能应该单独解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM