Node.js nodejs/electron forge/node gyp:在尝试了我在网上能找到的所有技巧之后,找不到任何VisualStudio安装可供使用 介绍

Node.js nodejs/electron forge/node gyp:在尝试了我在网上能找到的所有技巧之后,找不到任何VisualStudio安装可供使用 介绍,node.js,visual-studio,npm,electron,node-gyp,Node.js,Visual Studio,Npm,Electron,Node Gyp,在网上查阅了包括 这就引入了一些与官方文件不符的想法 我仍然无法安装某些需要在npm或Thread上本地构建的第三方软件包。我还没有收到来自nodejs或node-gypgithub问题论坛的任何回复 我即将推出一款应用程序,该应用程序已经在macOS上使用了electron forge,但无法在Windows上运行 主要问题是用于构建第三方包的npm依赖项之一node gyp在我的计算机上找不到Visual Studio。我使用VS2017社区,并为节点gyp安装了所有必需的组件

在网上查阅了包括

这就引入了一些与官方文件不符的想法

我仍然无法安装某些需要在npm或Thread上本地构建的第三方软件包。我还没有收到来自
nodejs
node-gyp
github问题论坛的任何回复

我即将推出一款应用程序,该应用程序已经在macOS上使用了
electron forge
,但无法在Windows上运行

主要问题是用于构建第三方包的
npm
依赖项之一
node gyp
在我的计算机上找不到Visual Studio。我使用VS2017社区,并为
节点gyp
安装了所有必需的组件

我的设置
  • 节点版本
    Node-v
    =v12.18.3和
    npm-v
    =6.14.8
  • 平台
    systeminfo | findstr/B/C:“操作系统名称”/C:“操作系统版本”/C:“系统类型”
    (Windows)
  • 编译器
    msbuild/version&cl
    (Windows)
  • 模块:zeromq
详细输出(来自npm或节点gyp):

我尝试过的事情都没有用
  • 使用C++桌面开发工具包重新安装VS 2017
  • 重新安装节点和npm
  • 在Admin CMD、Admin PowerShell、Admin VC2017 Dev命令提示符中运行相同的命令
  • 手动将VCINSTALLDIR环境变量设置为:
    C:\ProgramFiles(x86)\Microsoft Visual Studio\2017\Community\
  • 运行
    npm-config-set-msvs\u version 2017--global
    ,然后
    npm-config-get-msvs\u version
    给出2017
  • 每一步都要重启电脑
我每走一步都会犯同样的错误

进一步的尝试 我已经取消了整个nodejs安装并重新开始,但问题依然存在。我所做的

  • 已删除基于的节点
  • 使用nodejs官方网站上的.msi安装程序重新安装了适用于Windows v12.18.3的nodejs x64,允许安装程序安装额外的依赖项,如Chocolate
  • 使用
    electron forge
    创建了一个空白的electron应用程序:如下所示
me@me-pc0d:\Desktop
$npx创建电子应用程序myapp
√ 正在初始化项目目录
√ 初始化Git存储库
√ 定位自定义模板:“基本”
√ 复制起始文件
√ 初始化NPM模块
√ 安装模板依赖项
√ 安装NPM依赖项
me@me-pc0d:\Desktop
$cd myapp
me@me-PC0 D:\Desktop\myapp
$npm开始
> myapp@1.0.0启动D:\Desktop\myapp
>电子锻造启动
√ 检查您的系统
√ 定位应用程序
√ 准备本机依赖项
√ 启动应用程序
  • npm使用的配置VS版本:
    npm配置设置msvs\U 2017版
    npm配置设置msvs\U 2017版--全局
应用程序一直运行到这一点。然后

  • 已安装的依赖项zeromq
$npm安装zeromq--保存产品
npm警告已弃用request@2.88.2:请求已被否决,请参阅https://github.com/request/request/issues/3142
npm警告不推荐的har-validator@5.1.5:不再支持此库
npm WARN rm未删除D:\Desktop\myapp\node\u modules\.bin\extract-zip.cmd,因为它不是由D:\Desktop\myapp\node\u modules\extract-zip安装的
npm WARN rm未删除D:\Desktop\myapp\node\u modules\.bin\extract zip,因为它不是由D:\Desktop\myapp\node\u modules\extract zip安装的
npm WARN rm未删除D:\Desktop\myapp\node\u modules\.bin\rimraf.cmd,因为它不是由D:\Desktop\myapp\node\u modules\rimraf安装的
npm WARN rm未删除D:\Desktop\myapp\node\u modules\.bin\rimraf,因为它不是由D:\Desktop\myapp\node\u modules\rimraf安装的
npm WARN rm未删除D:\Desktop\myapp\node\u modules\.bin\semver.cmd,因为它不是由D:\Desktop\myapp\node\u modules\semver安装的
npm WARN rm未删除D:\Desktop\myapp\node\u modules\.bin\s版本,因为它不是由D:\Desktop\myapp\node\u modules\s版本安装的
> zeromq@6.0.0-beta.6安装D:\Desktop\myapp\node\u模块\zeromq
>节点gyp构建
>核心-js@3.6.5postinstall D:\Desktop\myapp\node\u模块\core js
>节点-e“try{require('./postinstall')}catch(e){}”
感谢您使用core js(https://github.com/zloirock/core-js )用于填充JavaScript标准库!
这个项目需要你的帮助!请考虑支持开放式集体或Patreon的核心JS:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
此外,core js(https://github.com/zloirock )正在找一份好工作——)
npm通知创建了一个锁文件,名为package-lock.json。你应该提交这个文件。
npm WARN optional跳过可选依赖项:electron installer debian@^3.0.0(node_modules\@electron forge\maker deb\node_modules\electron installer debian):
npm WARN notsup跳过可选依赖项:不支持electron安装程序的平台-debian@3.1.0:通缉{“os”:“darwin,linux”,“arch”:“any”}(当前:{“os”:“win32”,“arch”:“x64”})
npm WARN optional跳过可选依赖项:electron installer redhat@^3.2.0(node_modules\@electron forge\maker rpm\node_modules\electron installer redhat):
npm WARN notsup跳过可选依赖项:不支持electron安装程序的平台-redhat@3.2.0:通缉{“os”:“darwin,linux”,“arch”:“any”}(当前:{“os”:“win32”,“arch”:“x64”})
npm警告myapp@1.0.0没有存储库字段。
+ zeromq@6.0.0-beta.6
在61.306秒内,添加了来自7个贡献者的50个包,删除了32个包,更新了401个包,并审核了460个包
32个方案正在寻求资金
有关详细信息,请运行“npm基金”
发现0个漏洞
  • 运行electron forge以构建Windows发行版
$npm运行模式
> myapp@1.0.0使D:\Des
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18362 N/A Build 18362
System Type:               x64-based PC
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

15.9.21.664Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27043 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]
me@me-PC0 D:\Desktop\myapp
# node-gyp configure --msvs_version=2017
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.0
gyp info using node@12.18.3 | win32 | x64
gyp info find Python using Python version 3.8.5 found at "C:\Python\Python38\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 2017
gyp ERR! find VS running in VS Command Prompt, installation path is:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
gyp ERR! find VS - will only use this version
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 msvs_version does not match this VS Command Prompt or the
gyp ERR! find VS installation cannot be used.
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 (C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack     at C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack     at C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack     at C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:20
gyp ERR! stack     at C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Apps\\nodejs\\node.exe" "C:\\Users\\me\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--msvs_version=2017"
gyp ERR! cwd D:\Desktop\myapp
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v7.1.0
gyp ERR! not ok
Auto-detection fails for Visual C++ Build Tools 2015, so --msvs_version=2015 needs to be added (not needed when run by npm as configured above):

$ node-gyp configure --msvs_version=2015