一.通过命令配置

  1. 命令 ``` npm config set registry https://registry.npmmirror.com

还原

npm config set registry http://registry.npmjs.org

  1. 2. 验证命令

npm config get registry

  1. 二、通过使用cnpm安装
  2. 1. 安装cnpm

npm install -g cnpm —registry=https://registry.npmmirror.com

  1. 2. 使用cnpm

cnpm install xxx

  1. 三、electron镜像

npm config set registry=https://registry.npmmirror.com npm config set disturl=https://registry.npmmirror.com/-/binary/node npm config set electron_mirror=https://registry.npmmirror.com/-/binary/electron/v npm config set electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/ ```