我尝试使用npm i ndb --global
安装node debug,但收到以下错误:
msvs_version was set from command line or npm config
gyp ERR! find VS - looking for Visual Studio version 2019
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 valid versions for msvs_version:
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 ***********************
字符串
我有Visual Studio 2019社区版,安装了C++工作负载的桌面开发。我已经把msvs_version设置成这样了:npm config set msvs_version=2019
个
那么,问题是,如何设置VCINSTALLDIR变量?
1条答案
按热度按时间dced5bon1#
尝试在Visualo Studio中打开命令提示符。运行
SET VSIN
获取变量的当前值。在我的例子中:VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\Community\
个使用GUI或命令行设置变量。注意,由于路径中有空格,因此必须使用“”标记。然后因为它以斜杠结尾,所以你需要转义最后一个斜杠,否则它会选择最后一个“作为变量的一部分。
SETX VSINSTALLDIR C:\Program Files\Microsoft Visual Studio\2022\Community\” 现在repoen你正在运行
npm ...`的终端,你应该看到变量被设置了。