首页 Mac下vue-cli4创建项目报错:gyp: No Xcode or CLT version detected!解决办法

Mac下vue-cli4创建项目报错:gyp: No Xcode or CLT version detected!解决办法

jaeheng 2020-02-12 11:56:10 1 1701

在Mac上使用vue-cli4创建项目时报错,提示:gyp: No Xcode or CLT version detected!

完整报错信息如下

> 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:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248: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/jaeheng/workspace/vue-cell-cube/node_modules/fsevents
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

解决办法:

1. 安装xcode

2. 打开一下xcode,打开过程中会自动安装一些别的

3. 使用vue-cli重新创建项目


如果是catalina系统,可能还会报这个错,需要运行命令:

> sudo xcode-select -s /Applications/Xcode.app/Contents/Developer


mac · vue-cli4 ·

发表评论

评论列表:

2020-03-25 17:52
这个方法可以!感谢