設置鏡像服務器信息
國內用戶使用npm安裝軟件常常會失敗,此處使用淘寶鏡像
//設置環境變量
export ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
安裝指定版本
安裝前需要確認https://npm.taobao.org/mirrors/electron/上存在對應的版本
//安裝指定版本,16.0.6為版本號
npm install electron@16.0.6
設置淘寶源
npm install -g cnpm --registry=https://registry.npmmirror.com
npm config set registry https://registry.npm.taobao.org/
npm config get registry //檢查是否更換成功
恢復默認來源
npm config set registry https://registry.npmjs.org/