npm config set registry https://registry.npm.taobao.org
编辑 ~/.npmrc 加入下面内容
registry="https://registry.npm.taobao.org"
ELECTRON_MIRROR="https://cdn.npm.taobao.org/dist/electron/"
然后运行
npm install electron -g --unsafe-perm --allow-root