install.js是electronic这个包里的,里面的下载是依赖于electronic-download这个模块
此包有如下标注:
You can set the ELECTRON_MIRROR or NPM_CONFIG_ELECTRON_MIRROR environment variable or mirror opt variable to use a custom base URL for grabbing Electron zips. The same pattern applies to ELECTRON_CUSTOM_DIR and ELECTRON_CUSTOM_FILENAME:
Electron Mirror of China
ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"
or for a local mirror
ELECTRON_MIRROR="https://10.1.2.105/"
ELECTRON_CUSTOM_DIR="our/internal/filePath"
You can set ELECTRON_MIRROR in .npmrc as well, using the lowercase name:
electron_mirror=https://10.1.2.105/
因而解决方案:
1>编辑 gedit ~/.npmrc
加入以下内容
registry=https://registry.npm.taobao.org
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=http://npm.taobao.org/mirrors/phantomjs
ELECTRON_MIRROR=http://npm.taobao.org/mirrors/electron/
2>若安装过程中(其实主要是node-sass)网速慢,可以运行npm config set registry https://registry.npm.taobao.org来加速