MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。

Node.js 安装模块遇到 MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装 .NET Framework 2.0 SDK;2) 安装 Microsoft Visual Studio 2005;或 3) 如果将该组件安装到了其他位置,请将其位置添加到系统路径中。 gyp ERR! stack Error

具体错误信息如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
D:\node_modules\selenium-webdriver\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装 .NET Framework 2.0 SDK;2) 安装 Microsoft Visual Studio 2005;或 3) 如果将该组件安装到了其他位置,请将其位置添加到系统路径中。 [D:\node_modules\selenium-webdriver\node_modules\ws\node_modules\bufferut
il\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
  stack     at ChildProcess.onExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
command "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\node_modules\selenium-webdriver\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
 
[email protected] install D:\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild

这个错误的原因还是得看 https://github.com/nodejs/node-gyp 可以看出问题出在没有Microsoft Visual Studio Express 2013 for Windows Desktop,摘录如下。

You can install with npm:

$ npm install -g node-gyp

You will also need to install:

  • On Unix:

    • python (v2.7 recommended, v3.x.x is not supported)

    • make

    • A proper C/C++ compiler toolchain, like GCC

  • On Mac OS X:

    • You also need to install the Command Line Tools via Xcode. You can find this under the menu Xcode -> Preferences -> Downloads

    • This step will install gcc and the related toolchain containing make

    • python (v2.7 recommended, v3.x.x is not supported) (already installed on Mac OS X)

    • Xcode

  • On Windows:

    • For 64-bit builds of node and native modules you will also need the Windows 7 64-bit SDK

    • You may need to run one of the following commands if your build complains about WindowsSDKDir not being set, and you are sure you have already installed the SDK:

    • Microsoft Visual Studio C++ 2013 for Windows Desktop (Express version works well)

    • Microsoft Visual Studio C++ 2013 (Express version works well)

    • If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first

    • If you get errors that the 64-bit compilers are not installed you may also need thecompiler update for the Windows SDK 7.1

    • Make sure that you have a PYTHON environment variable, and it is set to drive:\path\to\python.exe not to a folder

    • Python (v2.7.3 recommended, v3.x.x is not supported)

    • Windows XP/Vista/7:

    • Windows 7/8:

    • All Windows Versions

call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x86
call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x64

If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the '--python' variable:

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

If node-gyp is called by way of npm and you have multiple versions of Python installed, then you can set npm's 'python' config key to the appropriate value:

$ npm config set python /path/to/executable/python2.7

Note that OS X is just a flavour of Unix and so needs pythonmake, and C/C++. An easy way to obtain these is to install XCode from Apple, and then use it to install the command line tools (under Preferences -> Downloads).

我的系统是window 10,所以我安装了 Microsoft Visual Studio Express 2013 for Windows Desktop 。 一切正常。


你可能感兴趣的:(msbuild,安装,c语言,杂谈)