Raz Omessi
Raz Omessi

Reputation: 1882

windows 7 install mongodb module with npm

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

Upvotes: 1

Views: 1050

Answers (2)

John Smith
John Smith

Reputation: 1005

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.

Upvotes: 0

nick
nick

Reputation: 19834

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

Upvotes: 3

Related Questions