npm install上的node-gyp错误:bson和kerberos编译中的致命错误C1083

有没有人有解决scheme的path来成功解决这个问题?

我发现这个错误在Windows上遵循nodejs,express,mongodb教程。

我的环境是Windows 10 x64,nvm for windows(使用v.012.7 x64)。 环境已经安装了vs2015 c ++构build工具,而python 2.7(x64)和系统正在使用它。 node-gyp通过npm install全局安装。

我得到的编译错误(针对bson和kerberos上的许多文件)如下:

D:\projects\express-tut\nodetest1> npm install > bson@0.2.22 install D:\projects\express-tut\nodetest1\node_modules\bson > (node-gyp rebuild 2> builderror.log) || (exit 0) D:\projects\express-tut\nodetest1\node_modules\bson>if not defined npm_config_node_gyp (node "C:\Users\Javier\AppData\Roaming\nvm\v0.12.7\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild ) Los proyectos de esta solución se van a compilar de uno en uno. Para habilitar la compilación en paralelo, agregue el modificador "/m". bson.cc C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory [D:\projects\express-tut\nodetest1\node_modules\bson\build\bson.vc xproj] 

您可以在要点中看到更详细的问题摘要,以及下面的屏幕截图:

https://gist.github.com/javlc/67220256c6e51573dc07

屏幕截图的错误(显示两次)。 http://imgur.com/aSQV3vs

你的帮助解决这个非常赞赏。

考虑到您已经正确安装了构build工具(包括Windows 8.1 sdk和Windows 10 sdk),您可以在cmd.exe中尝试下列命令:

  • npm config set msvs_version 2015 –global
  • reg添加HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ VisualStudio \ SxS \ VS7 / v 14.0 / t REG_EXPAND_SZ / d ^%programfiles(x86)^%“\ Microsoft Visual Studio 14.0 \”
  • SET PATH =%ProgramFiles(x86)%\ MSBuild \ 14.0 \ Bin;%PATH%

它应该在那之后工作。 你可以在这里find更多的信息: 1,2 ,或在讨论中的其他post。