国内访问外网都很慢,甚至不能访问!大家都懂,都很无奈!
安装Node时自带的npm地址默认是:http://registry.npmjs.org ,访问很慢! 没事,咋们换成国内的!怎么换?
一、通过config命令
npm config set registry http://registry.cnpmjs.org npm info underscore
(如果上面配置正确这个命令会有字符串response)
1
2
二、命令行指定
npm –registry http://registry.cnpmjs.org info underscore
1
三、编辑node_modules\npm.npmrc加入下面内容
registry = http://registry.cnpmjs.org
1
如果上面的npm地址不行的话,大家可以试试淘宝的npm,非常稳定:
地址:https://registry.npm.taobao.org
查看node安装目录,在终端输入
which node