解决(gyp、python等问题):gyp ERR! find VS msvs_version not set from command line or npm config

一、遇到问题

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, try re-running with '--loglevel silly' for more details
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 **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use

二、出现问题的原因

就是这个项目缺少很多node.js相关的开发工具和依赖,比如python、Visual Studio、gyp等等

三、解决办法

1.先设置npm的源为国内的淘宝镜像源

npm config set registry https://registry.npm.taobao.org

 

2.执行这个命令自动检测下载python、Visual Studio等等这些需要的东西。

npm install --g --production windows-build-tools

这个命令是用于在 Windows 操作系统上安装 windows-build-tools 包,它是一个 Node.js 模块,用于安装和配置在 Windows 上构建 Node.js 模块所需的开发工具和依赖项 

下载完成后使用快捷键CTRL+C结束当前的命令 

  • 6
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论
### 回答1: 这个错误通常是由于缺少 Visual Studio 的版本信息导致的。可以通过以下方法解决: 1. 确保已经安装了最新版本的 Visual Studio,并且已经添加到了系统环境变量中。 2. 如果已经安装了 Visual Studio 但还是无法解决问题,可以尝试在命令行中设置 msvs_version 参数。例如: ``` npm config set msvs_version 2017 ``` 这里将 msvs_version 设置为 2017,你可以根据自己的实际情况设置。 3. 如果以上方法都无法解决问题,可以尝试升级 Node.js 版本,或者使用其他版本的 Node.js。有些 Node.js 版本可能会与某些 Visual Studio 版本不兼容,会导致出现这个错误。 希望这些方法可以帮助你解决问题。 ### 回答2: gyp ERR!find VS msvs_version not set from command line or npm config错误是在使用npm安装依赖包时出现的。这个错误通常是因为系统缺少Visual Studio的相关组件或者没有正确设置msvs_version的值。 要解决这个问题,可以尝试以下步骤: 1. 确保系统已经安装了Visual Studio以及相关的C++组件。如果没有安装,可以前往Microsoft官方网站下载并安装Visual Studio。 2. 如果已经安装了Visual Studio,可以打开Visual Studio的开发人员命令提示符,然后运行npm安装命令。这样可以确保相关环境变量和配置已经设置正确。 3. 可以尝试在运行npm安装命令时添加msvs_version的参数,例如: npm install --msvs_version=2017 4. 另外,你也可以在npm的配置文件中设置msvs_version的值。可以通过以下命令查看npm的配置文件位置: npm config get userconfig 打开该文件,修改或添加msvs_version的值为你系统中已经安装的Visual Studio版本,例如: msvs_version=2017 5. 如果以上步骤均无效,可以尝试卸载并重新安装Node.jsnpm,并确保安装的版本是最新的。 总结来说,gyp ERR!find VS msvs_version not set from command line or npm config错误是由于缺少Visual Studio组件或者没有正确设置msvs_version的值导致的。通过安装Visual Studio、检查环境变量和配置、添加参数或设置配置文件中的msvs_version值等方式,可以解决这个问题。 ### 回答3: gyp ERR! find VS msvs_version not set from command line or npm config 是一个错误信息,通常出现在使用Node.js的项目中,涉及到使用了某些需要编译的模块或插件。 这个错误的意思是在执行npm install命令时,系统无法找到VS的版本信息。VS代表Visual Studio,也就是缺少了Visual Studio的版本设置。它可能是由于没有正确配置或设置npm或命令行环境变量导致的。 要解决这个错误,有几个可能的方案: 1. 检查是否已经安装了Visual Studio或者Windows SDK。如果没有,可以从Microsoft的官方网站下载并安装适合您系统版本的Visual Studio或Windows SDK。 2. 如果已经安装了Visual Studio或Windows SDK,可以尝试通过在命令行中设置msvs_version解决问题。例如,您可以执行以下命令来设置msvs_version为所需的版本:npm config set msvs_version 2017。在此示例中,将msvs_version设置为2017年版本。 3. 可以尝试执行npm config edit命令,打开npm配置文件,查找msvs_version并确保已设置为所需的版本。如果没有找到,可以手动添加msvs_version字段并设置为所需的版本。 请注意,具体的解决方案可能因个人计算机环境的不同而有所差异。在解决问题时,根据错误信息和个人实际情况进行相应的调整和尝试。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云边的快乐猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值