解决(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结束当前的命令 

猜你喜欢

转载自blog.csdn.net/m0_52861000/article/details/132914900
今日推荐