yarn/npm 设置镜像地址
注意
如果开发 electron 桌面软件,需要设置以下两个镜像地址
disturl
、electron_mirror
如果用到了 node-sass 需要设置以下一个镜像地址
sass_binary_site
yarn
yarn config set registry https://registry.npm.taobao.org -g
yarn config set disturl https://npm.taobao.org/dist -g
yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g
yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g
npm
npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist
npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/
备注
此方案可以完美解决 electron 项目在 ubuntu 下安装依赖、打包报错的问题,其他 os 也可配置上述地址来加速前端项目安装、打包过程,不限于 electron 项目
原文地址:https://www.cnblogs.com/myesn/p/14994938.html