«

node-gyp安装vuetify编译失败如何解决

时间:2024-7-25 09:07     作者:韩俊     分类: Javascript


这篇文章主要介绍“node-gyp安装vuetify编译失败如何解决”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“node-gyp安装vuetify编译失败如何解决”文章能帮助大家解决问题。

    问题

    在安装 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 FilesPython38python.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 安装):

    成功安装!

    标签: javascript vue

    热门推荐