1

Im trying to install the mongodb on my Windows 7. I installed the Windows 7 SDK, globally installed node-gyp.

I installed express-generator, and generate a test app. When Im trying to run this command:

"npm install mongodb --save" 

Im getting this error:

"gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 2148734720"

log:

> kerberos@0.0.15 install c:\node\test1\node_modules\mongodb\node_modules\mongod
b-core\node_modules\kerberos
> (node-gyp rebuild) || (exit 0)
c:\node\test1\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerber
os>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_module
s\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )
else (node  rebuild )
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` fail
ed with exit code: 2148734720
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\node\test1\node_modules\mongodb\node_modules\mongodb-core\node_m
odules\kerberos
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
mongodb@2.0.45 node_modules\mongodb
├── es6-promise@2.1.1
├── readable-stream@1.0.31 (string_decoder@0.10.31, core-util-is@1.0.1, isarray@
0.0.1, inherits@2.0.1)
└── mongodb-core@1.2.14 (bson@0.4.16, kerberos@0.0.15)

Really looking for help. Thanks

Raz Omessi
  • 1,812
  • 1
  • 14
  • 13
  • Really not sure what's going on here.. Do you have Python installed as well? – nick Oct 11 '15 at 23:49
  • Yep, this was the first problem, i intalled python 2.7. Btw before this problem, i got an error that my sdk dir variable hasnt found in the registery, and cl.exe cannot be found, so i installed the windows 7 sdk with .net4 – Raz Omessi Oct 12 '15 at 05:05
  • Have you been able to get past this issue? If not, can you try `node-gyp rebuild --verbose` and see if that gives you any more insight? I believe the output log will be quite large so perhaps you could use a paste service and link it here. – nick Oct 13 '15 at 18:41
  • I didnt solve this yet. at the meantime i bought a Centos 6 vps and it work just fine on it except the fact that i cant work locally. i typed "node-gyp rebuild --verbose" and this is the log: http://pastie.org/10480178. – Raz Omessi Oct 14 '15 at 05:46
  • Good to hear you were able to find a workaround. Can you try the following on your Windows machine: Clear NPM cache (delete npm_modules folder), run `npm config set msvs_version 2013 --global`, then `npm install` again? – nick Oct 15 '15 at 00:29
  • Side note- my Win10 PC is my main development machine but for some things (like this), linux and OS X are far better options. I opted for a linux VPS just like you. With `win-sshfs` it is actually quite easy to get an environment similar to strictly working off a local box- basically you can mount your VPS' filesystem as a disk in Windows and work directly off that. I've found it to be fast and relatively stable. – nick Oct 15 '15 at 00:35
  • Thanks a lot Nick! it solve my problem. I will try win-sshfs. Thanks! – Raz Omessi Oct 15 '15 at 12:42
  • Awesome, I'll leave the solution as an answer below in case someone else runs into the same issue. – nick Oct 15 '15 at 16:30

2 Answers2

3

It seems a lot of people have trouble building native modules on Windows. If anyone else runs into node-gyp errors like the one above, try the following steps:

  • Ensure you have the latest version of node and npm installed
  • Ensure you have Python 2 installed.
  • Ensure you have the MSVC build tools installed. Easiest way to do this is to install Visual Studio (with the C++ component)
  • Clear your NPM cache (delete node_modules from your project folder)
  • Run npm config set msvs_version 2013 --global
  • Run npm install

Reference: node-gyp build error windows x64

Community
  • 1
  • 1
nick
  • 18,784
  • 2
  • 24
  • 31
0

Error code is actually code 0x80131700 (2148734720 to hex). To fix it, just start msbuild.exe like this:

MsBuild [Full path to SLN] /nologo /p:Configuration=Release;Platform=[x64 or x86]

This will throw an error. For me it said that the incorrect .NET framework was installed and it asked me if I wanted to install it now. I chose yes and after installing it worked fine.

John Smith
  • 965
  • 1
  • 9
  • 22