在使用gyp进行node-gyp重建时,`npm install`失败:未检测到Xcode或CLT版本! [英] `npm install` fails on node-gyp rebuild with `gyp: No Xcode or CLT version detected!`

查看:81
本文介绍了在使用gyp进行node-gyp重建时,`npm install`失败:未检测到Xcode或CLT版本!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我尝试 npm install .我收到以下错误.我该如何解决?

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

gyp: No Xcode or CLT version detected!

我在 node -v→v8.8.0 & npm -v→v6.11.3

我试图在VSCode终端和iTerm上运行它,但最终都遇到了相同的错误.(均已更新为最新版本).我所做的唯一新事情是将我的 macOS 更新到最新版本(今天是 Catalina 10.15.3).

I tried to run it on VSCode terminal and iTerm, but both ended up getting the same error. (both are updated to the latest version). The only new thing I did is updating my macOS to the latest version (Catalina 10.15.3 today).

$ 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

推荐答案

即使已经安装了它们(我的情况),但通过升级到Catalina(10.15.*),您仍会收到此错误(我的情况:)).

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 (requires large redownload) 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

注意:

  • 您不需要为每个项目都做一次,只需一次
  • 也有讨论,您必须在每次OSX更新时都执行此操作,就我而言,以后更新OSX系统不会再次触发此问题

信用至: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆