在前端项目安装包的过程中,经常因为网络原因导致npm、yarn等工具安装依赖失败,这里使用国内镜像的方式来实现国内镜像源,可以明显加快速度减少因网络原因导致的失败
- git clone 加速
访问这个网站跟github是一样的,在git clone的时候,替换掉https://github.com即可完成代码clone加速
http://git.what996.com
- npm 设置淘宝代理
npm config set registry https://registry.npm.taobao.org
npm config list ## 查看刚才的配置是否生效
## 临时制定淘宝镜像
npm install data_js --registry=https://registry.npm.taobao.org
- yarn 设置淘宝代理
yarn config set ELECTRON_MIRROR https://npm.taobao.org/mirrors/electron/