2012-10-05 109 views
2

我試圖在使用NPM的Windows 7 Box上安裝MongoDB。我已經安裝了Python和VC++,但得到以下錯誤---在使用NPM的Windows 7 Box上安裝MongoDB時出錯

C:\code\digital-marketing\audience-plus-api>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 C:\code\digital-marketing\audience-plus-api\node_modules\mongodb\node_modules 
\bson 
> node-gyp rebuild || (exit 0) 


C:\code\digital-marketing\audience-plus-api\node_modules\mongodb\node_modules\bson>node "C:\Progra 
m Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.j 
s" rebuild 
    bson.cc 
..\ext\bson.cc(8): fatal error C1083: Cannot open include file: 'alloca.h': No such file or direc 
tory [C:\code\digital-marketing\audience-plus-api\node_modules\mongodb\node_modules\bson\build\bs 
on.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:\Program Files (x86)\nodejs\node_modules\npm\node_mod 
ules\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" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gy 
p\\bin\\node-gyp.js" "rebuild" 
gyp ERR! cwd C:\code\digital-marketing\audience-plus-api\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] 

任何人有任何想法?

乾杯 MACCA

回答

1

我有這個確切的問題。我打算在mongoDB中使用貓鼬,所以安裝後,因爲貓鼬的文檔沒有明確說明npm install mongodb

NPM安裝貓鼬工作得很好,給了我這個建議

用C++ BSON解析器安裝做

npm install mongodb --mongodb:native 

我決定測試,如果貓鼬是工作,它讓我感動的。 如果你不打算使用貓鼬那麼也許嘗試上面或者如果使用貓鼬剛跳過

npm install mongodb 
+0

+1,有點瘋狂,不過這也爲我工作 – Wh1T3h4Ck5