未在 Windows 8.1 上构建的节点包 - 缺少 Microsoft.Cpp.Default.props

NPM 包未在 Windows 8.1 上构建 - 失败并出现以下错误,

NPM packages are not building on Windows 8.1 - failing with following error,

error MSB4019:未找到导入的项目C:Microsoft.Cpp.Default.props".确认 <Import> 中的路径.声明是正确的,并且该文件存在于磁盘上.

我尝试了以下方法,

  • 将环境变量 VCTargetsPath 设置为 C:Program Files (x86)MSBuild12.0(错误相应更改,但没有 Microsoft.Cpp.Default.props 与 2012 构建工具).
  • 根据此答案
  • 安装 VisualStudio 2010 环境(先卸载,然后按正确顺序安装)
  • 完全删除了 VisualStudio 2010 并尝试使用 VisualStudio 2012,它应该根据 Node-gyp wiki
  • 根据这个答案
  • 添加了注册表项
  • 根据这个答案
  • 尝试使用 Windows 7.1 SDK 命令提示符
  • 在根据这个答案
  • 运行 npm 之前尝试设置 VisualStudioVersion
  • 尝试根据这个答案将--msvs_version=2012传递给npm>
  • Setting an evironment variable VCTargetsPath to C:Program Files (x86)MSBuild12.0 (The error changes accordingly but there is no Microsoft.Cpp.Default.props with the 2012 build tools).
  • Installing a VisualStudio 2010 environment (uninstalled then installed in the correct order) according to this answer
  • Completely removed VisualStudio 2010 and tried a VisualStudio 2012 instead, which should work according to the Node-gyp wiki
  • Added registry keys according to this answer
  • Tried using the Windows 7.1 SDK command prompt according to this answer
  • Tried setting VisualStudioVersion before running npm according to this answer
  • Tried passing --msvs_version=2012 to npm according to this answer

以上都没有奏效.

我已经在这上面花了很长时间.有没有人有一个明确的有效答案?

I've spent ages on this already. Does anyone have a definite answer that works?

推荐答案

现在是凌晨 2.47 - 想通了.

So it is 2.47am - figured it out.

尽管 node-gyp 站点似乎建议使用 Visual Studio 2010 或 2012,但对于 Windows 8.1,请安装 适用于 Windows 桌面的 Visual Studio Express 2013,如这个问题.

Although the node-gyp site seems to suggest using Visual Studio 2010 or 2012, instead for Windows 8.1, install Visual Studio Express 2013 for Windows Desktop as discussed in this issue.

相关文章