C++ 所有VisualStudio安装程序崩溃,visual build工具获胜';也不行

C++ 所有VisualStudio安装程序崩溃,visual build工具获胜';也不行,c++,node.js,npm,node-gyp,C++,Node.js,Npm,Node Gyp,如果nodejs,特别是nodegyp不依赖于它,我就不会和visualstudio鬼混了。我真正想做的就是安装活动win npm包,但因为它有一个窗口API依赖项,我需要运行node gyp,这让我陷入了困境 不管出于什么原因,2015 visual studio安装程序崩溃了,但我只是简单地使用了npm install--global--production windows构建工具。它成功地安装了构建工具,但是,这里的问题仍然存在 这也是一个较小的错误,节点gyp尝试在/v120/中查找,尽

如果nodejs,特别是nodegyp不依赖于它,我就不会和visualstudio鬼混了。我真正想做的就是安装活动win npm包,但因为它有一个窗口API依赖项,我需要运行node gyp,这让我陷入了困境

不管出于什么原因,2015 visual studio安装程序崩溃了,但我只是简单地使用了
npm install--global--production windows构建工具
。它成功地安装了构建工具,但是,这里的问题仍然存在

这也是一个较小的错误,节点gyp尝试在/v120/中查找,尽管msmversion设置为2015,但我通过设置VCTargetsPath位置修复了这个错误

以下是此时运行npm i-D active win的全部错误:

C:\Users\Henry Hunt\Documents\GitRep\ludite>npm install -D active-win

> iconv@2.3.5 install C:\Users\Henry Hunt\Documents\GitRep\ludite\node_modules\iconv
> node-gyp rebuild


C:\Users\Henry Hunt\Documents\GitRep\ludite\node_modules\iconv>if not defined npm_config_node_gyp (node "N:\Nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "N:\Nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Users\Henry Hunt\Documents\GitRep\ludite\node_modules\iconv\build\iconv.vcxproj(20,3): error MSB4019: The imported p
roject "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Default.props" was not found. Confirm that
 the path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (N:\Nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "N:\\Nodejs\\node.exe" "N:\\Nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Henry Hunt\Documents\GitRep\ludite\node_modules\iconv
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

> ref-napi@1.4.2 install C:\Users\Henry Hunt\Documents\GitRep\ludite\node_modules\ref-napi
> node-gyp rebuild


C:\Users\Henry Hunt\Documents\GitRep\ludite\node_modules\ref-napi>if not defined npm_config_node_gyp (node "N:\Nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "N:\Nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Users\Henry Hunt\Documents\GitRep\ludite\node_modules\ref-napi\node_modules\node-addon-api\src\nothing.vcxproj(20,3)
: error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Default.pro
ps" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (N:\Nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "N:\\Nodejs\\node.exe" "N:\\Nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Henry Hunt\Documents\GitRep\ludite\node_modules\ref-napi
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN @date-io/date-fns@1.3.11 requires a peer of date-fns@2.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN extract-text-webpack-plugin@3.0.2 requires a peer of webpack@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iconv@2.3.5 (node_modules\iconv):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iconv@2.3.5 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ref-napi@1.4.2 (node_modules\ref-napi):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ref-napi@1.4.2 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ active-win@6.0.0
added 2 packages from 3 contributors, updated 1 package and audited 10413 packages in 6.338s
found 0 vulnerabilities
C:\Users\Henry Hunt\Documents\GitRep\ludite>npm安装-D active win
> iconv@2.3.5安装C:\Users\Henry Hunt\Documents\GitRep\ludite\node\u modules\iconv
>节点gyp重建
C:\Users\Henry Hunt\Documents\GitRep\ludite\node\u modules\iconv>如果未定义npm\u config\u node\u gyp(节点“N:\Nodejs\node\u modules\npm\node\u modules\npm生命周期\node gyp bin\\\\\\\\\\\\\\\\\\\\\\\\ node\u modules\node gyp.js”重建)其他(节点“N:\Nodejs\node\node\node\node\node\node\u modules\node\node\node\node\gyp\node
在此解决方案中一次构建一个项目。要启用并行生成,请添加“/m”开关。
C:\Users\Henry Hunt\Documents\GitRep\ludite\node\u modules\iconv\build\iconv.vcxproj(20,3):错误MSB4019:导入的
未找到项目“C:\Program Files(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Default.props”。证实
声明中的路径正确,并且文件存在于磁盘上。
哎呀!构建错误
哎呀!堆栈错误:`C:\Program Files(x86)\MSBuild\14.0\bin\MSBuild.exe`失败,退出代码:1
哎呀!ChildProcess.onExit上的堆栈(N:\Nodejs\node\u modules\npm\node\u modules\node gyp\lib\build.js:194:23)
哎呀!ChildProcess.emit上的堆栈(events.js:210:5)
哎呀!在Process.ChildProcess.\u handle.onexit(internal/child\u Process.js:272:12)处堆栈
哎呀!系统Windows\u NT 10.0.18362
哎呀!命令“N:\\Nodejs\\node.exe”“N:\\Nodejs\\node\u modules\\npm\\node\u modules\\node gyp\\bin\\node gyp.js”“重建”
哎呀!cwd C:\Users\Henry Hunt\Documents\GitRep\ludite\node\u modules\iconv
哎呀!节点-v12.13.1
哎呀!节点gyp-v5.0.5
哎呀!不好
>参考号-napi@1.4.2安装C:\Users\Henry Hunt\Documents\GitRep\ludite\node\u modules\ref napi
>节点gyp重建
C:\Users\Henry Hunt\Documents\GitRep\ludite\node\u modules\ref napi>如果未定义npm\u config\u node\u gyp(节点“N:\Nodejs\node\u modules\npm\node\u modules\npm生命周期\node gyp bin\\\\\\\\\\\\\\\\\\\\\\\\\ node\u modules\node gyp.js重建)其他(节点“N:\node\node\node\node\node\node\u模块\node\node\gyp\bin\node gyp.js重建)
在此解决方案中一次构建一个项目。要启用并行生成,请添加“/m”开关。
C:\Users\Henry Hunt\Documents\GitRep\ludite\node\u modules\ref napi\node\u modules\node addon api\src\nothing.vcxproj(20,3)
:错误MSB4019:导入的项目“C:\Program Files(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Default.pro”
找不到“ps”。确认声明中的路径正确,并且文件存在于磁盘上。
哎呀!构建错误
哎呀!堆栈错误:`C:\Program Files(x86)\MSBuild\14.0\bin\MSBuild.exe`失败,退出代码:1
哎呀!ChildProcess.onExit上的堆栈(N:\Nodejs\node\u modules\npm\node\u modules\node gyp\lib\build.js:194:23)
哎呀!ChildProcess.emit上的堆栈(events.js:210:5)
哎呀!在Process.ChildProcess.\u handle.onexit(internal/child\u Process.js:272:12)处堆栈
哎呀!系统Windows\u NT 10.0.18362
哎呀!命令“N:\\Nodejs\\node.exe”“N:\\Nodejs\\node\u modules\\npm\\node\u modules\\node gyp\\bin\\node gyp.js”“重建”
哎呀!cwd C:\Users\Henry Hunt\Documents\GitRep\ludite\node\u modules\ref napi
哎呀!节点-v12.13.1
哎呀!节点gyp-v5.0.5
哎呀!不好
npm警告@日期io/日期-fns@1.3.11需要一个日期对等者-fns@2.1.0但没有安装。您必须自己安装对等依赖项。
npm警告提取文本网页包-plugin@3.0.2需要webpack@^3.1.0的对等机,但未安装。您必须自己安装对等依赖项。
npm警告可选跳过可选依赖项:iconv@2.3.5(节点\u模块\iconv):
npm警告可选跳过可选依赖项:iconv@2.3.5安装:`node gyp rebuild`
npm警告可选跳过可选依赖项:退出状态1
npm警告可选跳过可选依赖项:ref-napi@1.4.2(节点\u模块\ref napi):
npm警告可选跳过可选依赖项:ref-napi@1.4.2安装:`node gyp rebuild`
npm警告可选跳过可选依赖项:退出状态1
+活跃的-win@6.0.0
在6.338s中添加了来自3个贡献者的2个包,更新了1个包,并审核了10413个包
发现0个漏洞
安装的构建工具版本为2015,其输入的文件夹\V140\实际上是存储配置的位置。缺少的一个文件是Microsoft.Cpp.Default.props。我没能找到有同样问题的人。很多人都有相同的错误,但在解决他们的问题时,Microsoft.Cpp.Default.props只是在其他目录中。这是它应该在的目录,它不在那里


如何修复此问题?

首先,我下载了Visual Studio 2019,而不是使用节点构建工具。尽管节点生成工具声称安装了实际的C:/Program文件(x86)/MSBuild,但其中没有npm需要的任何文件。在我完全卸载以前的Visual Studio安装程序后,2019安装程序运行良好

在那之后,事情变得很简单。以下是您需要做的:

  • npm配置设置msvs\U 2019版
  • npm配置集msbuild\u路径“C:\\Program Files(x86)\\Microsoft Visual Studio\\2019\\common