Npm切换镜像源

时间:2021-08-11 15:31:23   收藏:0   阅读:13

使用npm可以很方便的安装各种Node模块,但是npm默认连接的镜像库在国外,致使我们安装模块时很慢,甚至出现卡死现象。

官方镜像

https://registry.npmjs.org/

淘宝镜像

这是一个完整 npmjs.org 镜像,你可以用此代替官方版本(只读),同步频率目前为 10分钟 一次以保证尽量与官方服务同步。
网站地址:https://npm.taobao.org/

切换到淘宝镜像

1. 临时使用

npm --registry https://registry.npm.taobao.org

2. 永久使用

npm config set registry https://registry.npm.taobao.org

3. 验证配置

npm config get registry

使用cnpm工具

1. 安装

npm install -g cnpm --registry=https://registry.npm.taobao.org

2. 使用

cnpm install xxx



参考文献:https://www.cnblogs.com/yuzizsj/p/11845240.html

原文:https://www.cnblogs.com/luckyfan/p/15127690.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!