NPM installation error

房东的猫 提交于 2019-12-10 13:54:05

问题


I tried installing browserify (npm module).. I got following error-

praful@ubuntu:~/terminalcloud$ npm install -g browserify
npm http GET https://registry.npmjs.org/browserify

npm ERR! Error: failed to fetch from registry: browserify
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/praful/terminalcloud/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "browserify"
npm ERR! cwd /home/praful/terminalcloud
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: browserify
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/praful/terminalcloud/npm-debug.log
npm not ok

I have installed npm package properly. This error occurs for any package that I try installing with npm. What should I do to?


回答1:


Just wondering, have you tried

npm config set registry http://registry.npmjs.org/

as per this




回答2:


The probleme comes from the registry you are using, it is using a secure connection with the hyper transfert text protocol, that might screw things up. https://registry.npmjs.org/browserify you should use a simple registry that is easy fetchable :

sudo npm config set registry http://registry.npmjs.org/


来源:https://stackoverflow.com/questions/21359456/npm-installation-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!