Electron-Builder 镜像设置指南
要设置 electron-builder 的镜像,可以在项目的 package.json 文件中添加以下内容:
"build": {
"appId": "com.example.app",
"directories": {
"output": "build"
},
"publish": [
{
"provider": "generic",
"url": "https://example.com/releases"
}
],
"win": {
"target": "nsis"
},
"nsis": {
"perMachine": false,
"oneClick": false,
"allowToChangeInstallationDirectory": true
},
"linux": {
"target": "AppImage"
},
"mac": {
"target": "dmg"
}
},
"electronBuilder": {
"npmRebuild": false,
"electronDownload": {
"mirror": "https://npm.taobao.org/mirrors/electron/" // 指定镜像地址
}
}
上述代码中,我们通过在 electronBuilder 字段下的 electronDownload 字段中设置 mirror 属性来指定 electron-builder 的镜像地址。在这个例子中,我们使用了淘宝镜像(https://npm.taobao.org/mirrors/electron/)。您可以根据自己的需要选择其他镜像地址。
设置完成后,运行 electron-builder 命令时,electron-builder 将会使用指定的镜像地址来下载 electron。
原文地址: https://www.cveoy.top/t/topic/l9N6 著作权归作者所有。请勿转载和采集!