gpt4 book ai didi

node.js - 使用 NPM 在 Windows 7 Box 上安装 MongoDB 时出错

转载 作者:可可西里 更新时间:2023-11-01 10:44:34 25 4
gpt4 key购买 nike

我正在尝试使用 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

有人有什么想法吗?

干杯麦加

最佳答案

我确实遇到了这个问题。我打算将 mongoose 与 mongoDB 一起使用,因此安装之后,因为 mongoose 文档没有明确说明 npm install mongodb

npm install mongoose 运行良好并给了我这个建议

要使用 C++ bson 解析器安装

npm install mongodb --mongodb:native 

我决定测试 mongoose 是否正常工作,所以我继续前进。如果您不打算使用 Mongoose ,那么可以尝试上面的方法,或者如果使用 Mongoose ,则跳过

npm install mongodb

关于node.js - 使用 NPM 在 Windows 7 Box 上安装 MongoDB 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12749341/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com