12

我有带有 SP1 和 Windows sdk 7.1 的 Visual Studio 2010。我也有 VS2012 和 Windows 套件 8。

当我运行Windows SDK 7.1 Command Prompt并运行node-gyp build --msvs_version=2010它给我错误:

error MSB3411: Could not load the Visual C++ component "VCBuild.exe". 
If the component is not installed,
either 1) install the Microsoft Windows SDK for Windows Server 2008 and .NET Fr
amework 3.5, or 2) install Microsoft Visual Studio 2008.

它是否试图找到 VCBuild.exe。

我发现vcbuild 已被替换为 msbuild

这是一个有效的错误吗?

我还发现,在 Windows 7 中,对于 .NET 3.5,您只需从控制面板打开它。我已经查看了有关 stackoverflow 的其他问题,例如此处

但问题是,既然 vcbuild.exe 在带有 vs2010 的系统中不存在,那么为什么 node-gyp 正在搜索它呢?还是我错过了什么?

我该如何解决这个错误?

4

4 回答 4

25

以下内容对我有用(截至 2014 年 6 月),如此所述。

  • 安装免费的 Visual Studio Express 2013 for Windows(不是 VS Express 2013 for Web)

  • npm 安装 --msvs_version=2013

否则,我花了很多时间安装旧的 Microsoft 软件包和补丁,但没有任何帮助。

于 2014-06-22T22:56:44.150 回答
7

设置node-gyp wiki中列出的 VS2010 和其他应用程序解决了这些问题。

在 Windows XP/Vista/7 上,node-gyp 需要 Python 2.7 和 Visual Studio 2010

根据 Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for Windows SDK 7.1 中的自述文件,以确保您的系统具有受支持的配置,

首先卸载以下产品(如果您想节省大量时间)

然后按列出的顺序重新安装它们:(您可以按任何顺序卸载:P)

Visual Studio 2010

Windows SDK 7.1

Visual Studio 2010 SP1

Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1

在 x64 环境中,列表中的最后一个更新修复了有关缺少编译器和

error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found.

于 2013-09-13T06:30:31.260 回答
6

您所有问题的答案都在这里。费了好大劲才找到这个。终于让它工作了。=)

只是为了节省您访问链接的时间,这是该链接中有用的。

指示:

您可以使用 npm 安装:

$ npm install -g node-gyp

您还需要安装:

在 Unix 上:

  • python(推荐v2.7,不支持v3.xx)

  • 制作一个合适的 C/C++ 编译器工具链,比如 GCC

在 Windows 上:

  • Python(推荐 v2.7.3,不支持 v3.xx)

  • Windows XP/Vista/7:Microsoft Visual Studio C++ 2010(Express 版运行良好)

  • 对于节点和本机模块的 64 位构建,您还需要 Windows > 7 64 位 SDK

  • 如果安装失败,

    • 尝试卸载您首先安装的任何 C++ 2010 x64&x86 Redistributable。

    • 如果您收到未安装 64 位编译器的错误,您可能还需要 Windows SDK 7.1 的编译器更新

视窗 7/8:

  • Microsoft Visual Studio C++ 2012/13 for Windows Desktop(Express 版本运行良好)

  • 如果您安装了多个 Python 版本,您可以通过设置“--python”变量来识别 node-gyp 使用的 Python 版本:

$ node-gyp --python /path/to/python2.7

如果通过 npm 调用 node-gyp 并且您安装了多个版本的 Python,那么您可以将 npm 的“python”配置键设置为适当的值:

$ npm config set python /path/to/executable/python2.7
于 2015-04-21T05:54:17.570 回答
3

这可以通过使用提升的 cmd(以管理员身份运行)使用 Microsoft 的windows-build-tools安装所有必需的工具和配置来解决。npm install --global --production windows-build-tools

于 2016-09-22T19:57:28.453 回答