npm修改或切换镜像地址

方法一: 直接编辑npm的配置文件

npm config edit

直接修改registry的地址

sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
electron_mirror=https://npm.taobao.org/mirrors/electron/
registry=https://registry.npm.taobao.org

方法二:用代码更改npm的配置文件

npm config set regestry http://registry.npm.taobao.org

这段代码即将镜像改为淘宝镜像

方法三: 使用nrm管理registry地址

安装nrm

npm install -g nrm

查看镜像列表

nrm ls

切换镜像

nrm use taobao
扫描二维码关注公众号,回复: 1678177 查看本文章

ps:r_name镜像名字, r_url镜像地址

在nrm添加自己的镜像地址

nrm add r_name r_url

删除

nrm del r_name

测试镜像的相应速度

nrm test r_name

猜你喜欢

转载自www.cnblogs.com/susu8/p/9208826.html