npm 包下载很慢的解决方案

国内访问外网都很慢,甚至不能访问!大家都懂,都很无奈!
安装Node时自带的npm地址默认是:http://registry.npmjs.org ,访问很慢! 没事,咋们换成国内的!怎么换?

1.通过config命令

npm config set registry http://registry.cnpmjs.org  npm info underscore

(如果上面配置正确这个命令会有字符串response)

2.命令行指定

npm --registry http://registry.cnpmjs.org info underscore

3.编辑node_modules\npm.npmrc加入下面内容

registry = http://registry.cnpmjs.org

如果上面的npm地址不行的话,大家可以试试淘宝的npm,非常稳定:

地址:https://registry.npm.taobao.org

更多解决方案:https://www.uedbox.com/post/8151/

https://npm.taobao.org/

扫描二维码关注公众号,回复: 6700885 查看本文章

https://github.com/cnpm/cnpm

https://github.com/qiu8310/smart-npm/

https://github.com/Pana/nrm

https://segmentfault.com/a/1190000002642514

猜你喜欢

转载自www.cnblogs.com/ZheOneAndOnly/p/10739759.html
今日推荐