有基于 VsCode 二次开发的编译器应用(IDE),对于应用打包,采用 Jenkins 来持续构建;在折腾 Mac 环境时,有遇到诸多问题;其中就有:“gyp: No Xcode or CLT version detected!” 问题;详细错误如下:
nkins/workspace/JADE_YYY/node_modules/keytar: Command failed.
**10:06:59** Exit code: 1
**10:06:59** Command: prebuild-install || npm run build
**10:06:59** Arguments:
**10:06:59** Directory: /Users/xxx/jenkins/workspace/JADE_YYY/node_modules/keytar
**10:06:59** Output:
**10:06:59** /Users/xxx/jenkins/workspace/JADE_YYY/node_modules/node-abi/index.js:30
**10:06:59** throw new Error('Could not detect abi for version ' + target + ' and runtime ' + runtime + '. Updating "node-abi" might help solve this issue if it is a new release of ' + runtime)
**10:06:59** ^
**10:06:59**
**10:06:59** Error: Could not detect abi for version 13.5.2 and runtime electron. Updating "node-abi" might help solve this issue if it is a new release of electron
......
......
**10:06:59** gyp: No Xcode or CLT version detected!
**10:06:59** gyp ERR! configure error
**10:06:59** gyp ERR! stack Error: `gyp` failed with exit code: 1
**10:06:59** gyp ERR! stack at ChildProcess.onCpExit (/Users/xxx/jenkins/workspace/JADE_YYY/node_modules/node-gyp/lib/configure.js:351:16)
**10:06:59** gyp ERR! stack at ChildProcess.emit (events.js:400:28)
**10:06:59** gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
**10:06:59** gyp ERR! System Darwin 20.6.0
**10:06:59** gyp ERR! command "/usr/local/bin/node" "/Users/xxx/jenkins/workspace/JADE_YYY/node_modules/.bin/node-gyp" "rebuild"
**10:06:59** gyp ERR! cwd /Users/xxx/jenkins/workspace/JADE_YYY/node_modules/keytar
**10:06:59** gyp ERR! node -v v14.18.2
**10:06:59** gyp ERR! node-gyp -v v5.1.1
**10:06:59** gyp ERR! not ok
**10:06:59** info Visit [https://yarnpkg.com/en/docs/cli/install](https://yarnpkg.com/en/docs/cli/install) for documentation about this command.
**10:07:47** Build step 'Execute shell' marked build as failure
**10:07:49** Finished: FAILURE
通过 Google 检索,在 gyp: No Xcode or CLT version detected macOS Catalina 一文中找到了解决办法;该文中,有详细讲解了问题的原因,以及各种解决办法。按着文章给出的方案,在执行如下命令,即解决了问题,故此特记,以寄来者:
sudo xcode-select --reset
您可能感兴趣(/有用)的文章