内容纲要
npm install -g yarn
  1. 全局修改
yarn config set registry https://registry.npm.taobao.org/
  1. 临时修改
yarn save 软件名 --registry https://registry.npm.taobao.org/
  1. yrm
npm install -g yrm
yrm ls
yrm use taobao
yrm test taobao

如果还是安装失败,可能是 electron 下载太慢和 node-sass 编译不过。设置

yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
yarn config set ELECTRON_MIRROR https://npm.taobao.org/mirrors/electron/

使用 electron7 版本

使用 yarn 有点问题,还是使用 cnpm 靠谱一点
npm run dev 没问题, npm run build 还是有问题,需要下载
windows 下缓存目录 C:\Users\Rover\AppData\Local\electron\Cache

cd /d "C:\Users\Rover\AppData\Local\electron\Cache"
wget https://npm.taobao.org/mirrors/electron/7.1.7/electron-v7.1.7-win32-x64.zip

cd /d "C:\Users\Rover\AppData\Local\electron-builder\Cache\winCodeSign"
wget https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.5.0/winCodeSign-2.5.0.7z

cd /d "C:\Users\Rover\AppData\Local\electron-builder\Cache\nsis"
wget https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.3.2/nsis-3.0.3.2.7z

npm run build 需要下载的工具

  • winCodeSign-2.5.0.7z
  • nsis-3.0.3.2.7z

参考

发表评论

电子邮件地址不会被公开。 必填项已用*标注