vue-element-admin框架install失败问题

最终解决方案

已提交至项目issuse,点击查看

问题环境

coandeMacBook-Pro:vue-admin-template mac$ node -v
v15.11.0
coandeMacBook-Pro:vue-admin-template mac$ npm -v
7.6.0
coandeMacBook-Pro:vue-admin-template mac$ node-gyp-v
bash: node-gyp-v: command not found
coandeMacBook-Pro:vue-admin-template mac$ node-gyp -v
v8.0.0
coandeMacBook-Pro:vue-admin-template mac$ python -V
Python 2.7.16

错误描述/日志

npm ERR! code 1
npm ERR! path /Users/mac/Desktop/coan/project/vue-admin-template/node_modules/bufferutil
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@12.19.0 | darwin | x64
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/bufferutil/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/mac/.node-gyp/12.19.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/mac/.node-gyp/12.19.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/mac/.node-gyp/12.19.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/bufferutil',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
npm ERR! 
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
npm ERR! 
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
npm ERR! 
npm ERR! gyp: No Xcode or CLT version detected!
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/node-gyp/lib/configure.js:345:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
npm ERR! gyp ERR! System Darwin 20.4.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/mac/Desktop/coan/project/vue-admin-template/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/mac/Desktop/coan/project/vue-admin-template/node_modules/bufferutil
npm ERR! gyp ERR! node -v v12.19.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mac/.npm/_logs/2021-04-28T08_38_20_523Z-debug.log

填坑之路

1、node-gyp

在错误日志中发现npm ERR! gyp: No Xcode or CLT version detected!

于是,毅然决然npm install node-gyp -g
发现install报错,详情请转 NODE-GYP On macOS

2、python版本

原以为是python版本问题导致gyp重构失败,于是更新了python
但是发现python@3.9还是报这个错,2.7会报其他错误但是也包含npm ERR! code 1
具体python在macOS中的升级操作可以查看文章macOS自带Python2.7版本升级

3、canvas

在某国外论坛看到有老哥说事canvas已知bug,原因好像是因为缺少lib包,但是经过尝试,没有解决

最终解决方案

nrm use npm,npm install,npm run dev成功运行,解决–【需要使用npm自己的源安装】

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值