2

NPM を使用して Windows 7 ボックスに MongoDB をインストールしようとしています。Python と VC++ をインストールしましたが、次のエラーが発生します ---

C:\code\digital-marketing\audience-plus-api>npm install mongodb
npm WARN package.json assert@0.4.9 No README.md file found!
npm WARN package.json url@0.7.9 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 bson@0.1.5 No README.md file found!

> bson@0.1.5 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
mongodb@1.1.9 node_modules\mongodb
└── bson@0.1.5

誰でもアイデアはありますか?

乾杯マッカ

4

1 に答える 1

1

私はこの正確な問題を抱えていました。私はmongoDBでmongooseを使用するつもりであり、mongooseのドキュメントには明示的に記載されていないため、インストールされていますnpm install mongodb

npm install mongoose は問題なく動作し、このアドバイスをくれました

C++ bson パーサーでインストールするには、次のようにします。

npm install mongodb --mongodb:native 

私はマングースが機能しているかどうかをテストすることにしました。マングースを使用しない場合は、上記を試すか、マングースを使用する場合はスキップしてください

npm install mongodb
于 2012-10-07T15:37:28.667 に答える