【发布时间】:2012-12-26 01:12:15
【问题描述】:
我无法安装任何需要编译的模块。他们都失败并出现以下错误:
MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". ...
我的环境:
- Windows 7 企业版 x64,版本 6.1.7601
- 节点 x86 0.8.16
- npm 1.2.0
- 节点-gyp 0.8.2
- Visual Studio 2012 和众多软件包
相关环境变量:
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShel l\v1.0;C:\Program Files\TortoiseGit\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\tools;c:\tools\node
没有 INCLUDE、LIB、LIBPATH 等。
我对该问题进行了简短调查,并发现通过以下设置手动编译(直接调用 VCBuild.exe 和 msbuild.exe)对于手动克隆的 git://github.com/einaros/ws 成功。混帐:
SET Configuration=Release
SET PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\vcpackages
SET PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\bin;%PATH%
SET PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\Common7\IDE;%PATH%
SET PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
SET PATH=%SystemRoot%\system32;%PATH%
SET INCLUDE=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\include
SET INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
SET LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Lib
SET LIB=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\lib;%LIB%
SET MSBUILD="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
VCBuild.exe C:\Tools\node\ws\build\bufferutil.vcproj "Release|Win32" /useenv
VCBuild.exe C:\Tools\node\ws\build\validation.vcproj "Release|Win32" /useenv
%MSBUILD% build/binding.sln /verbosity:diagnostic /nologo /p:Configuration=Release;Platform=Win32
我尝试使用相同的变量调用 node-gyp,但失败了:
C:\!> git clone https://github.com/einaros/ws.git
C:\!> cd ws
C:\!\ws>node-gyp configure
...
C:\!\ws>node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@0.8.2
gyp info using node@0.8.16 | win32 | ia32
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=Win32' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Users\User\.node-gyp\0.8.16\deps\uv\include\uv.h(55): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory [C:\!\
ws\build\binding.sln]
C:\Users\User\.node-gyp\0.8.16\deps\uv\include\uv.h(55): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory [C:\!\
ws\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
gyp ERR! stack at ChildProcess.onExit (c:\Tools\node\node_modules\node-gyp\lib\build.js:255:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "c:\\Tools\\node\\\\node.exe" "c:\\Tools\\node\\node_modules\\node-gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd C:\!\ws
gyp ERR! node -v v0.8.16
gyp ERR! node-gyp -v v0.8.2
gyp ERR! not ok
也许你会有一些想法?
谢谢。
【问题讨论】:
-
您是否尝试过运行
vcvarsall.bat而不是手动设置环境? -
没有成功。仍然是“MSB3411:无法加载 Visual C++ 组件“VCBuild.exe”。”
-
顺便说一句,“C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\SetEnv.Cmd”我有更好的结果:致命错误 C1083:无法打开包含文件:'stdint. h': 没有这样的文件或目录
-
我终于安装了 bcrypt,它需要在 win7 64 位环境下构建,排序很麻烦。根据我的情况,我按照 bcrypt 和 node-gyp 的说明进行操作。对我来说最重要的是安装 Microsoft Windows 7 SDK 和 .Net 4 框架。一旦安装了它(并且我已经重新启动了我的 shell),我发现我可以通过安装 bcrypt 来编译所有内容。所以我只是想知道你是否安装了 SDK?我问你,因为你没有在你的列表中提到它。
-
这是 2015 年 11 月 19 日发布的,它工作正常! (关于这个线程有很多好的建议,但没有乐趣)github.com/nodejs/node-gyp/issues/629#issuecomment-158163655 该程序安装的是 Build Tools 2015,而不是 VS2012。
标签: node.js visual-studio-2012 node-gyp