I’m having trouble setting up MongoDB through NPM on my Windows 7 machine. Even though I have Python and Visual C++ installed, the installation keeps failing with a compilation error.
Here’s the error I’m getting:
D:\projects\webapp\server>npm install mongodb
npm WARN package.json [email protected] No README.md file found!
npm WARN package.json [email protected] No README.md file found!
npm http GET https://registry.npmjs.org/mongodb
npm http 304 https://registry.npmjs.org/mongodb
npm http GET https://registry.npmjs.org/bson/0.1.5
npm http 304 https://registry.npmjs.org/bson/0.1.5
npm WARN package.json [email protected] No README.md file found!
> [email protected] install D:\projects\webapp\server\node_modules\mongodb\node_modules\bson
> node-gyp rebuild || (exit 0)
D:\projects\webapp\server\node_modules\mongodb\node_modules\bson>node "D:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
bson.cc
..\ext\bson.cc(8): fatal error C1083: Cannot open include file: 'alloca.h': No such file or directory [D:\projects\webapp\server\node_modules\mongodb\node_modules\bson\build\bson.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `D:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:219:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! stack at Process._handle.onexit (child_process.js:674:10)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "D:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\projects\webapp\server\node_modules\mongodb\node_modules\bson
gyp ERR! node -v v0.8.8
gyp ERR! node-gyp -v v0.6.7
gyp ERR! not ok
[email protected] node_modules\mongodb
└── [email protected]
The error seems to be related to a missing ‘alloca.h’ file during the BSON compilation process. Has anyone encountered this issue before and found a solution?
Thanks in advance!