electron-builder 下载 electron过慢或报错的解决办法

 

OKAY  take it away `electron-builder`
 
  • electron-builder version=19.56.2
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=build/electron-builder.yaml
  • no native production dependencies
  • packaging       platform=darwin arch=x64 electron=1.8.8 appOutDir=build/mac
Downloading tmp-2221-0-electron-v1.8.8-darwin-x64.zip
[==>                                          ] 8.5% of 48.34 MB (6.38 kB/s)

或如下:

下载半天也没反应,设置一下镜像就好了

 

  "build": {
    "appId": "cn.toside.music.desktop",
    "directories": {
      "output": "./build"
    },
    "files": [
      "dist/electron/**/*"
    ],
    "extraResources": [
      "./licenses"
    ],
    "electronDownload":{
      "mirror":"https://npm.taobao.org/mirrors/electron/"
    },
    "win": {
      "icon": "./resources/icons/256x256.ico",
      "legalTrademarks": "lyswhut",
      "artifactName": "${productName} v${version} ${env.ARCH} ${env.TARGET}.${ext}"
    },

 

 

如果还是下载不了相关的包,那么就下载二进制包放进缓存目录,各操作系统包的位置如下:

macOS ~/Library/Caches/electron-builder
linux ~/.cache/electron-builder
windows %LOCALAPPDATA%\electron-builder\cache

在%LOCALAPPDATA%(C:\Users\Administrator\AppData\Local)或(C:\Users\Administrator\AppData\Local\electron\Cache)

 

posted @ 2021-04-07 15:40  一个人的孤独自白  阅读(724)  评论(0编辑  收藏  举报