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

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

发布于: 2020-02-12 07:56:10
字数: 1200
评论: 1
阅读: 4870

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



扫描二维码,在手机上阅读
评论列表:
太仓人才网
2020-03-25 17:52
这个方法可以!感谢