node.js - 安装 VS2019 node-gyp find VS 仍然报错
问题描述
我已经安装了 VS2019(包括 MSBuild)
当我跑步时node-gyp configure --msvs_version=2019
,node-gyp rebuild
我会得到以下错误
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@14.9.0 | win32 | x64
gyp info find Python using Python version 3.7.9 found at "C:\ProgramData\Anaconda3\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, 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
gyp ERR! stack at VisualStudioFinder.fail
gyp ERR! node -v v14.9.0
gyp ERR! node-gyp -v v7.1.2
就像有人以前问过的这个问题(node-gyp configure got "gyp ERR! find VS")但是问题中的方法对我不起作用。还有其他方法可以解决这个问题吗?
解决方案
我已经解决了这个问题。这是由于我的环境变量被污染了。因此,只需删除错误的变量并重新安装依赖项,然后设置变量即可。
推荐阅读
- pulumi - 如何保护特定 Pulumi 堆栈中的资源不被删除
- powershell - 如何解决 PowerShell Set-ADUser 错误
- selenium - Raspbian 上的 Chromium 浏览器版本 83
- css - 为什么@use不在sass中编译?
- google-data-studio - 如何在 Google Data Studio 上设置条形图
- php - 如何在 Doctrine 查询生成器或 MySQL 中计算内部连接表行数?
- javascript - 在处理来自云 Firestore 的承诺时无法更新外部范围内的对象
- javascript - 为什么我在加载有材质的 GLTF 模型时会得到黑色模型?
- haskell - cmdargs 的强制参数
- c++ - 正确的 QML <-> C++ 声明式方法