Download the electron fails solutions when using electron-builder package

electron-builder in the package will detect whether there is electron package cache, if not, will got me from the github, the process in the domestic network environment pulls the high probability will fail, so you can go download yourself into a package cache directory

Each platform directory address

Linux: $XDG_CACHE_HOME or ~/.cache/electron/
MacOS: ~/Library/Caches/electron/
Windows: %LOCALAPPDATA%/electron/Cache or ~/AppData/Local/electron/Cache/

Reference: https: //github.com/electron/get#how-it-works

For example, in electron macos platform packaged applications, perform electron-builder --mac --x64

➜  clipboard git:(master) ✗ npm run dist

> [email protected] dist /Users/xx/workspace/electron/clipboard
> electron-builder --mac --x64

  • electron-builder  version=22.3.2 os=18.7.0
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=darwin arch=x64 electron=8.0.0 appOutDir=dist/mac
  • downloading     url=https://github.com/electron/electron/releases/download/v8.0.0/electron-v8.0.0-darwin-x64.zip size=66 MB parts=8

This package can be downloaded separately https://github.com/electron/electron/releases/download/v8.0.0/electron-v8.0.0-darwin-x64.zip, placed under ~ / Library / Caches / electron / directory

You can then complete package

Guess you like

Origin www.cnblogs.com/xiaoniuzai/p/12356208.html