Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install node modules that require compilation on 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". ... 

My environment:

  • Windows 7 Enterprise x64, version 6.1.7601
  • node x86 0.8.16
  • npm 1.2.0
  • node-gyp 0.8.2
  • Visual Studio 2012 and numerous packages

Related environment variables:

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 

No INCLUDE, LIB, LIBPATH, etc.

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.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 

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 [email protected] gyp info using [email protected] | 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 

Maybe you will have some ideas about it?

Thanks.

like image 747
Alex Netkachov Avatar asked Jan 11 '13 12:01

Alex Netkachov


People also ask

Is node JS compatible with Windows 7 64 bit?

Normally old operating system needs an old version of Node. JS. you can refer to old version of Node. JS here, you can also download this one, which is tested and working fine with Win7( win7 Ultimate v6.

How do I install node js on Windows 64 bit?

Step 1: Download Node.js Installer In a web browser, navigate to https://nodejs.org/en/download/. Click the Windows Installer button to download the latest default version. At the time this article was written, version 10.16.0-x64 was the latest version. The Node.js installer includes the NPM package manager.


2 Answers

Try that - will set it globally:

npm config set msvs_version 2012 --global 
like image 63
srfrnk Avatar answered Sep 20 '22 15:09

srfrnk


To do it without VS2010 installation, and only 2012, set the msvs_version flag:

node-gyp rebuild --msvs_version=2012

npm install <module> --msvs_version=2012

as per @Jacob comment

npm install --msvs_version=2013 if you have the 2013 version

like image 39
Alex Avatar answered Sep 18 '22 15:09

Alex