gpt4 book ai didi

node.js - `npm install mongodb` 出现错误

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

我只是尝试学习 mongodb,当我尝试为 node 安装 mongodb 时,出现如下所示的错误。

顺便说一句,我的环境:ubuntu 10.04 + node v0.6.9。我还使用 nvm,它在本地切换 Node 版本。

zhkzyth@geek:~/codeRep/Nodejs---MongoDB$ npm install mongodb
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

> bson@0.1.5 install /home/zhkzyth/codeRep/Nodejs---MongoDB/node_modules/mongodb/node_modules/bson
> node install.js || (exit 0)

================================================================================
= =
= Attempting to build bson c++ extension =
= Windows: no build will be attempted as binaries are prepackaged =
= Unix: on failure the package will still install without the C++ extension =
= =
================================================================================
node-gyp clean
gyp ERR! clean error
gyp ERR! stack Error: UNKNOWN, unknown error 'build'
gyp ERR! System Linux 2.6.32-45-generic
gyp ERR! command "node" "/usr/local/bin/node-gyp" "clean"
gyp ERR! cwd /home/zhkzyth/codeRep/Nodejs---MongoDB/node_modules/mongodb/node_modules/bson
gyp ERR! node -v v0.6.9
gyp ERR! node-gyp -v v0.8.3
gyp ERR! not ok
make: *** [clean] 错误 1
child process exited with code 2
mongodb@1.2.8 ./node_modules/mongodb
└── bson@0.1.5

最佳答案

我认为您无法在 0.6.19 之前的 Node.js 版本上安装它。这issue出现在 mongodb github issues 页面上,由于 Node 切换为使用 gyp 构建扩展而升级为失败。

关于node.js - `npm install mongodb` 出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14645474/

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