刚接触nodejs,按照网上的入门教程写了一个图片上传,并在浏览器上显示上传内容的应用,要用到一个叫forminable的外部模块。
我是在ubuntu12.04下弄的,按教程里说的输入npm install formidable 回车,就可以成功安装。可我照做后系统却给我返回了这个:
npm http GET https://registry.npmjs.org/formidable
npm ERR! Error: failed to fetch from registry: formidable
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.
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest.
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/veta/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "node" "/usr/bin/npm" "install" "formidable"
npm ERR! cwd /home/veta
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: formidable
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/veta/npm-debug.log
npm not ok
我是装了npm的,从上面系统返回的信息看,第一行貌似是尝试获取安装包什么的,但后来因为failed to fetch from registry的原因报错了。。问了问度娘,发现关于ubuntu下的这类问题少之又少,手足无措之际,唯有来SF求救~~怎样才能成功安装formidable 这一 node.js外部模块呢???
npm不太稳定,经常会出现连不上的情况,试试用淘宝的镜像吧