当我尝试安装 nodejs mongodb 驱动程序时出现以下错误:
(precise)me@localhost:~$ sudo npm install mongodb
npm http GET https://registry.npmjs.org/mongodb
npm ERR! Error: failed to fetch from registry: mongodb
npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.onIncoming (http.js:1261:11)
npm ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /home/me/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.8.11
npm ERR! command "node" "/usr/bin/npm" "install" "mongodb"
npm ERR! cwd /home/me
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: mongodb
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/me/npm-debug.log
npm not ok
(precise)me@localhost:~$
我在配备 32 位处理器的 chromebook(通过 crouton)上运行 ubuntu 12.04。
答案1
由于你安装的 Node.JS 已经过时,你应该至少更新到 Node v0.10.x
Ubuntu 12 的推荐方法是使用NodeSource PPA这是 Chris Lea 的 PPA 的延伸。
升级 Node.JS 也会升级 NPM。完成此操作后,请重试 MongoDB 安装。我目前正在多个不同平台上运行该库,并且运行良好。