npm install -g cnpm --registry=https://registry.npm.taobao.org
npm install -g nrm
nrm add npm http://registry.npmjs.org
nrm add taobao https://registry.npm.taobao.org
nrm use taobao
nrm ls
其中*号是当前npm使用的源地址,可以使用nrm use xx
命令切换npm的下载源
下面是我打包时候需要下载electron版本
npm config set ELECTRON_MIRROR https://npm.taobao.org/mirrors/electron/
npm config set ELECTRON_CUSTOM_DIR=版本号
版本号:像上面我打包的时候需要下载electron-v9.1.1-win32-x64的文件的,那么版本号就是9.1.1
参考:
1、https://www.jianshu.com/p/94d084ce6834
2、https://www.jianshu.com/p/520934cea5ee