gpt4 book ai didi

node.js - Node gyp 配置得到 "gyp ERR! find VS"

转载 作者:太空宇宙 更新时间:2023-11-03 21:51:03 27 4
gpt4 key购买 nike

我正在尝试启动有关 Node C/C++ 附加组件的内容。 node-gyp 命令出错

我已经安装了vs2019,我的命令是

node-gyp configure --msvs_version=2019

详细输出是

gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.3
gyp info using node@10.16.0 | win32 | x64
gyp info find Python using Python version 2.7.15 found at "C:\Users\seact\.windows-build-tools\python27\python.exe"
gyp ERR! find VS
gyp ERR! find VS 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 - found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
gyp ERR! find VS - could not find MSBuild in registry for this version
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 **************************************************************
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 (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at findVisualStudio2013 (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gyp ERR! stack at findVisualStudio2015 (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gyp ERR! stack at regSearchKeys (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\find-visualstudio.js:377:20)
gyp ERR! stack at regGetValue (D:\Program Files\node-win-x64\node_modules\node-gyp\lib\util.js:54:7)
gyp ERR! stack at D:\Program Files\node-win-x64\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:301:5)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "D:\\Program Files\\node-win-x64\\node.exe" "D:\\Program Files\\node-win-x64\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--msvs_version=2019"
gyp ERR! cwd D:\Projects\learn_node_ext
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok

最佳答案

您不必安装 Visual Studio,只需安装 Windows 构建工具即可:

  1. 以管理员身份运行 CMD
  2. 运行npm install --g --product windows-build-tools

这应该可以解决这个问题。

[1]: /image/31D1U.png

关于node.js - Node gyp 配置得到 "gyp ERR! find VS",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57541402/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com