将 node-gyp 与原子一起使用

Use node-gyp with atom

我看过很多关于 运行 c++ 文件的教程。这些教程中的大多数都使用名为 node-gyp 的包。我尝试通过

通过 npm 安装它
npm i node-gyp -g

并且有效。当我使用配置 node-gyp 时出现问题:

node-gyp configure

当我使用这个命令时它抛出这个错误:

gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@12.13.1 | win32 | x64
gyp info find Python using Python version 3.8.0 found at "...Path to Python"
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
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 **************************************************************
//more error stuff

我正在使用 atom,如果我可以在没有 vscode 的情况下使用它,我会很高兴。

尽管名称相似,但

Visual Studio 代码和 Visual Studio 是完全不相关的产品。如错误日志中所述,您需要安装与 node-gyp 兼容的 Visual Studio 版本(“Visual Studio 2017 或更高版本”。)这种依赖性的原因是 C/C++ 编译器包含在 Visual Studio 中。免费 community edition 应该足以让您继续前进。