npm安装在node-gyp重建失败,并带有```gyp:未检测到Xcode或CLT版本!''


11

每次尝试执行此操作npm install时,都会出现以下错误。我该如何解决?我在node -v → v8.8.0npm -v → v6.11.3

我尝试在vsCode terminal和上运行它iTerm,最后得到了相同的错误。(均已更新为最新版本)。我所做的唯一新动作是将macOS更新到最新版本,即Catalina 10.15.3今天。

$ npm install          Fri Mar  6 17:22:40 2020

> fsevents@1.2.11 install /Users/synapse/Documents/synapsefi-dev-ui/node_modules/watchpack/node_modules/fsevents
> 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
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/synapse/.nvm/versions/node/v8.8.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:344:16)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/Users/synapse/.nvm/versions/node/v8.8.0/bin/node" "/Users/synapse/.nvm/versions/node/v8.8.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/synapse/Documents/synapsefi-dev-ui/node_modules/watchpack/node_modules/fsevents
gyp ERR! node -v v8.8.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
npm WARN synapsefi-dev-ui@2.0.20 No repository field.
npm WARN The package country-data is included as both a dev and production dependency.
npm WARN The package react-dropzone is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/watchpack/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

Answers:


26

就我而言,我已经安装了它们,但是通过升级到Catalina(10.15。*),我收到了此错误。安装无济于事,因为您会收到一个已安装错误。

因此,您需要卸载并重新安装它们:

xcode-select --print-path
# in my case
sudo rm -r -f /Library/Developer/CommandLineTools
xcode-select --install

归功于:https : //medium.com/flawless-app-stories/gyp-no-xcode-or-clt-version-detected-macos-catalina-anansewaa-38b536389e8d


2
这对我有用,谢谢。我再次卸载并重新安装了xcode cli工具
Pavan

1
很高兴听到!
mPrinC

2
对我来说很棒!即使我的Mac随附了Catalina,并且我安装了xcode工具,也遇到了此问题。
ruohola



3

如果Mac已升级到macOS Catalina (10.15),则需要通过运行安装XCode命令行工具xcode-select --install。或者,如果您已经安装了完整的Xcode,则可以在菜单下找到它们Xcode → Open Developer Tool → More Developer Tools


3

我面临着同样的问题 错误信息

我重新安装了命令行工具。

重新安装

您需要找到安装目录。

xcode-select --print-path

删除现有安装:

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

通过运行安装:

xcode-select --install

1

通过删除以前安装的版本来重新安装命令行工具。

步骤1:首先,获取已安装的命令行工具的位置

xcode-select --print-path

上面命令/ Library / Developer / CommandLineTools的结果

第二步:删除文件夹

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

第三步-重新安装

xcode-select --install

随着命令行开发人员工具的重新安装,当您从命令行运行任何yarn或npm命令时,gyp:未检测到Xcode或CLT版本的错误消息应消失。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.