Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node-gyp build error windows x64

Here's what I've done so far on my x64 OS:

  • Installed Python (v2.7 --specifically 2.7.6) and added it to the system path (C:\Python27)
  • Installed MS VS C++ 2010 Express Version (I already had VS 2012 but without the C++ component)
  • Installed the compiler update for Windows SDK 7.1
  • Successfully executed node-gyp configure (from my add-on directory under nodejs\node_modules where binding.gyp is located)

  • ran node-gyp build (as administrator)** This is what crashed, leaving me with:

this error:

C:\Program Files\nodejs\node_modules\msnodesql>node-gyp build
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
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=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the   "/m" switch.

LINK : fatal error LNK1181: cannot open input file 'kernel32.lib' [C:\Program Files\nodejs\node_modules\msnodesql\build\sqlserver.vcxproj]

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:\Users\RNelson\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Users\\RNelson\\AppData\\Roaming\\npm\\node_modules\\node-      gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd C:\Program Files\nodejs\node_modules\msnodesql
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok

Any ideas as to what is going on? Thanks in advance! Just trying to use my node-sqlserver MS driver for Node.js

like image 651
Rachael Avatar asked Feb 04 '14 19:02

Rachael


People also ask

What is node gyp build?

js native addon build tool. node-gyp is a cross-platform command-line tool written in Node. js for compiling native addon modules for Node. js. It contains a vendored copy of the gyp-next project that was previously used by the Chromium team, extended to support the development of Node.

Does node gyp need Python?

node-gyp requires that you have installed a compatible version of Python, one of: v3. 7, v3. 8, v3. 9, or v3.

Why is node gyp needed?

node-gyp is a tool that enables the compilation of native add-on modules for Node in multiple platforms. It has widespread use and is included as a dependency in many NPM packages. On most systems, this isn't an issue, and installing node-gyp with the rest of your packages works as expected.


2 Answers

I had a similar problem. I found that this switch helped me

--msvs_version=2012

so for example

npm install --msvs_version=2012 <package>
like image 165
Kyle Avatar answered Sep 21 '22 14:09

Kyle


npm config set msvs_version 2013 --global worked for me as I use VS node tools and you dont need to specify msvs_version each time you do an npm install.

I had an issue whereby npm's config (c:\Users\username\ .npmrc) has an entry msvs_version=2012 which was out of date.

like image 39
devman81 Avatar answered Sep 21 '22 14:09

devman81