標籤:style http color os io ar div linux
npm ERR! at Object.parse (native)npm ERR! at RegClient.<anonymous> (/usr/local/node/lib/node_modules/npm/node_ modules/npm-registry-client/lib/request.js:266:23)npm ERR! at Request._callback (/usr/local/node/lib/node_modules/npm/node_modu les/npm-registry-client/lib/request.js:238:65)npm ERR! at Request.self.callback (/usr/local/node/lib/node_modules/npm/node_ modules/request/request.js:123:22)npm ERR! at Request.emit (events.js:98:17)npm ERR! at Request.<anonymous> (/usr/local/node/lib/node_modules/npm/node_m dules/request/request.js:893:14)npm ERR! at Request.emit (events.js:117:20)npm ERR! at IncomingMessage.<anonymous> (/usr/local/node/lib/node_modules/np /node_modules/request/request.js:844:12)npm ERR! at IncomingMessage.emit (events.js:117:20)npm ERR! at _stream_readable.js:938:16npm ERR! If you need help, you may report this *entire* log,npm ERR! including the npm and node versions, at:npm ERR! <http://github.com/npm/npm/issues>npm ERR! System Linux 2.6.32-358.el6.i686npm ERR! command "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "install" -g" "express"npm ERR! cwd /root/node/my-projectnpm ERR! node -v v0.10.30npm ERR! npm -v 1.4.21npm ERR! type unexpected_eosnpm ERR!npm ERR! Additional logging details can be found in:npm ERR! /root/node/my-project/npm-debug.lognpm ERR! not ok code 0[[email protected] my-project]# npm install -g expressnpm ERR! registry error parsing jsonnpm ERR! 404 404 Not Found: expressnpmnpm ERR! 404npm ERR! 404 ‘expressnpm‘ is not in the npm registry.npm ERR! 404 You should bug the author to publish itnpm ERR! 404npm ERR! 404 Note that you can also install from anpm ERR! 404 tarball, folder, or http url, or git url.npm ERR! System Linux 2.6.32-358.el6.i686npm ERR! command "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "install" "-g" "expressnpm" "ERR!" "registry" "error" "parsing" "json"npm ERR! cwd /root/node/my-projectnpm ERR! node -v v0.10.30npm ERR! npm -v 1.4.21npm ERR! code E404npm ERR!npm ERR! Additional logging details can be found in:npm ERR! /root/node/my-project/npm-debug.lognpm ERR! not ok code 0
看後面那麼多404想必是因為網路引起,安裝出錯,於是於是去查了一下,原來npm,也像Linux的軟體一樣有自己的鏡像源,感覺不錯,雖然也存在依賴關係,非常不錯、
下面就是切換npm鏡像源的方法有三種:
1.通過config命令
npm config set registry https://registry.npm.taobao.org npm info underscore (如果上面配置正確這個命令會有字串response)
2.命令列指定
npm --registry https://registry.npm.taobao.org info underscore
3.編輯~/.npmrc加入下面內容
registry = https://registry.npm.taobao.org
如果還是失敗就把三個方法都做一次