NPM Error:gyp: No Xcode or CLT version detected!

An ·
更新时间:2024-09-20
· 569 次阅读

问题

最近在macOS Catalina中使用npm安装模块,经常会出现如下错误:

> 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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16) gyp ERR! stack at ChildProcess.emit (events.js:210:5) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Darwin 19.3.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/yangjian/Documents/temp/test001/node_modules/fsevents gyp ERR! node -v v12.13.0 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok 截图如下

在这里插入图片描述

解决方案 1. 尝试用如下命令进行修复 $ xcode-select --install

系统提示如下信息:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

而事实上并没有所谓的"Software Update"可以更新

2. 正确姿势

一筹莫展之际,找到如下解决方案:

$ sudo rm -rf $(xcode-select -print-path) $ xcode-select --install

请参见:

https://github.com/schnerd/d3-scale-cluster/issues/7 https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md
作者:zhennann



version npm xcode error

需要 登录 后方可回复, 如果你还没有账号请 注册新账号
相关文章