解决node-gyp安装vuetify编译失败gyp ERR问题

问题

在安装 vuetify 的时候发现了 node-gyp 编译失败的问题,报错很友好:


gyp info it worked if it ends with ok
gyp info using node-gyp@5.1.0
gyp info using node@14.8.0 | win32 | x64
gyp info find Python using Python version 3.8.5 found at “D:\Program Files\Python38\python.exe”
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the “Desktop development with C++” workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************


就是说找到了我们的 python 3.8 环境,还缺少 vs 环境,我们去他提示的 https://github.com/nodejs/node-gyp#on-windows 看一下

在这里插入图片描述

我们不希望安装整个 vs ,太过于臃肿,所以我们选择第一种方案。

解决

这里使用 npm 做全局安装,使用 yarn 不能安装,如果 npm 太慢可以在这里先配置一下淘宝镜像源。

	npm install --global --production windows-build-tools

之后会输出正在安装 python 2.7 :

在这里插入图片描述

还需要一套 vs 开发 sdk ,他会静默安装,请耐心等待 C 盘空间减少 4 G 左右不再发生变化即可。

我们可以在系统程序管理中看到刚刚安装的依赖:

在这里插入图片描述

管理安装的依赖

在开始菜单使用 vs 安装工具可以管理已经安装的依赖,方便以后卸载:

在这里插入图片描述
可以看到安装了 2017 生成工具:

在这里插入图片描述

检查 C 盘

静默安装我们不知道安装到哪里了,检查一下 C 盘确认一下位置。

C:\Program Files (x86) 有 3.7 G 的依赖。

在这里插入图片描述

C:\ProgramData 有 500 M 的数据。

在这里插入图片描述

一共 4 G 多。

重新安装

重新安装 vuetify ,这里使用 yarn 安装也可以(上面的构建工具必须使用 npm 安装):

在这里插入图片描述

成功安装!

  • 18
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值