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:16 npm 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.i686 npm ERR! command "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "install" -g" "express" npm ERR! cwd /root/node/my-project npm ERR! node -v v0.10.30 npm ERR! npm -v 1.4.21 npm ERR! type unexpected_eos npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /root/node/my-project/npm-debug.log npm ERR! not ok code 0 [[email protected] my-project]# npm install -g expressnpm ERR! registry error parsing json npm ERR! 404 404 Not Found: expressnpm npm ERR! 404 npm ERR! 404 ‘expressnpm‘ is not in the npm registry. npm ERR! 404 You should bug the author to publish it npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, or http url, or git url. npm ERR! System Linux 2.6.32-358.el6.i686 npm 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-project npm ERR! node -v v0.10.30 npm ERR! npm -v 1.4.21 npm ERR! code E404 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /root/node/my-project/npm-debug.log npm 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
如果还是失败就把三个方法都做一次
时间: 2024-10-10 23:43:49