无法在 Windows 7 x64/VS2012 上安装需要编译的节点模块 [英] Cannot install node modules that require compilation on Windows 7 x64/VS2012

查看:38
本文介绍了无法在 Windows 7 x64/VS2012 上安装需要编译的节点模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法安装任何需要编译的模块.他们都失败并出现以下错误:

I cannot install any of the modules that require compilation. All they fail with the following error:

MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". ...

我的环境:

  • Windows 7 Enterprise x64,版本 6.1.7601
  • 节点 x86 0.8.16
  • npm 1.2.0
  • 节点-gyp 0.8.2
  • Visual Studio 2012 和众多软件包

相关环境变量:

Path=C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShel lv1.0;C:Program FilesTortoiseGitin;C:Program FilesMicrosoftWeb Platform Installer;C:Program Files (x86)Microsoft ASP.NETASP.NET Web Pagesv1.0;C:Program Files (x86)Windows Kits8.0Windows Performance Toolkit;C:Program FilesMicrosoft SQL Server110ToolsBinn;c:	ools;c:	ools
ode

无 INCLUDE、LIB、LIBPATH 等

No INCLUDE, LIB, LIBPATH, etc.

我对该问题进行了简短调查,并发现通过以下设置手动编译(直接调用 VCBuild.exe 和 msbuild.exe)可以成功手动克隆 git://github.com/einaros/ws.混帐:

I did a short investigation of the issue and figure out that with the following setup the manual compilation (calling VCBuild.exe and msbuild.exe directly) succeed for the manually cloned git://github.com/einaros/ws.git:

SET Configuration=Release
SET PATH=%ProgramFiles(x86)%Microsoft Visual Studio 9.0VCvcpackages
SET PATH=%ProgramFiles(x86)%Microsoft Visual Studio 11.0VCin;%PATH%
SET PATH=%ProgramFiles(x86)%Microsoft Visual Studio 11.0Common7IDE;%PATH%
SET PATH=%ProgramFiles(x86)%Microsoft SDKsWindowsv7.1ABin;%PATH%
SET PATH=%SystemRoot%system32;%PATH%

SET INCLUDE=%ProgramFiles(x86)%Microsoft Visual Studio 11.0VCinclude
SET INCLUDE=%ProgramFiles(x86)%Microsoft SDKsWindowsv7.1AInclude;%INCLUDE%

SET LIB=%ProgramFiles(x86)%Microsoft SDKsWindowsv7.1ALib
SET LIB=%ProgramFiles(x86)%Microsoft Visual Studio 11.0VClib;%LIB%

SET MSBUILD="%SystemRoot%Microsoft.NETFrameworkv4.0.30319msbuild.exe"

VCBuild.exe C:Tools
odewsuildufferutil.vcproj "Release|Win32" /useenv
VCBuild.exe C:Tools
odewsuildvalidation.vcproj "Release|Win32" /useenv
%MSBUILD% build/binding.sln /verbosity:diagnostic /nologo /p:Configuration=Release;Platform=Win32

我尝试使用相同的变量调用 node-gyp 并且失败了:

I've tried to call node-gyp with the same variables and it failed:

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:WindowsMicrosoft.NETFrameworkv4.0.30319msbuild.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:UsersUser.node-gyp.8.16depsuvincludeuv.h(55): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory [C:!
wsuildinding.sln]
C:UsersUser.node-gyp.8.16depsuvincludeuv.h(55): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory [C:!
wsuildinding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:WindowsMicrosoft.NETFrameworkv4.0.30319msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (c:Tools
ode
ode_modules
ode-gyplibuild.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

也许你会有一些想法?

谢谢.

推荐答案

试试看 - 将它全局设置:

Try that - will set it globally:

npm config set msvs_version 2012 --global

这篇关于无法在 Windows 7 x64/VS2012 上安装需要编译的节点模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆