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 node-gyp@0.12.2
gyp info using node@0.10.25 | 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
I came across this problem myself, and this is how I solved it using Visual Studio 2010:
Install following packages
Use
npm install
from the Windows SDK command prompt (you need this because it sets additional environment variables).Source: node-gyp instructions for VS2010
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.
After spending a while to get this to work (for me accepted answer didn't work, for me it's just half solution) i did following:
Sadly, you must have visual studio (i installed express edition 2013 for DESKTOP)
Installed python 2.7.3 (you don't have to set any environment variables)
Run cmd as administrator and go to you project root (where is you package.json file)
First run:
npm config set python C:\Python27\python.exe
Then:
npm install -msvs_version=2013
The trick is in command
npm config set python ...path_to_python_exe...
which will be provided by npm to dependency which needs python i guess. I don't know why setting python as env variable is not enough.For installing node-gyp in windows or any other OS
First you may have to download the node-gyp by
Then install by
you may need to do the above procedure as root/administrartor.
I had this same error now in 2015 when trying to install Keystone and I ran through all you told me but it didn't work on it's own. At the end, I just had to run the command
to set up the environment before running the command. (Don't freak out when it turns your window text green, it's working). So yeah I'd do the installations and set up environment variables in the same way everywhere on the internet suggests but make sure to run the above command before running any other command. It probably won't be useful to you, but hopefully it's useful to someone else. If that still doesn't work, MSVS version 2010 worked for me, so install that version and use the flag -msvs_version=2010 when running the npm command.
I had a similar problem. I found that this switch helped me
so for example