刚开始报错是缺图标,我在public
和build
文件都放了图标,继续删除node_modules
后打包还是报错,这种该怎么解决呢?
报错信息如下:
leadzone@vppfes2:~/wrrtest/mode/electron-egg$ npm run build-l
> ee@1.0.0 build-l
> electron-builder --config=./electron/config/builder.json --linux=deb --x64
• electron-builder version=23.6.0 os=4.19.0-11-linx-security-amd64
• loaded configuration file=/home/leadzone/wrrtest/mode/electron-egg/electron/config/builder.json
• writing effective config file=out/builder-effective-config.yaml
• packaging platform=linux arch=x64 electron=21.4.4 appOutDir=out/linux-unpacked
• building target=deb arch=x64 file=out/ee-linux-1.0.0-amd64.deb
⨯ unknown output format set
github.com/develar/app-builder/pkg/icons.convertSingleFile
/Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:305
github.com/develar/app-builder/pkg/icons.doConvertIcon
/Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:247
github.com/develar/app-builder/pkg/icons.ConvertIcon
/Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:56
github.com/develar/app-builder/pkg/icons.ConfigureCommand.func1
/Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:33
github.com/alecthomas/kingpin.(*actionMixin).applyActions
/Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/actions.go:28
github.com/alecthomas/kingpin.(*Application).applyActions
/Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:557
github.com/alecthomas/kingpin.(*Application).execute
/Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:390
github.com/alecthomas/kingpin.(*Application).Parse
/Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:222
main.main
/Volumes/data/Documents/app-builder/main.go:90
runtime.main
/usr/local/Cellar/go/1.17/libexec/src/runtime/proc.go:255
runtime.goexit
/usr/local/Cellar/go/1.17/libexec/src/runtime/asm_amd64.s:1581
⨯ /home/leadzone/wrrtest/mode/electron-egg/node_modules/app-builder-bin/linux/x64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1 failedTask=build stackTrace=Error: /home/leadzone/wrrtest/mode/electron-egg/node_modules/app-builder-bin/linux/x64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
at ChildProcess.<anonymous> (/home/leadzone/wrrtest/mode/electron-egg/node_modules/builder-util/src/util.ts:250:14)
at Object.onceWrapper (node:events:628:26)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1101:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5)
窗口配置
/**
* 主窗口
*/
config.windowsOption = {
title: "ee",
width: 980,
height: 650,
minWidth: 400,
minHeight: 300,
webPreferences: {
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
nodeIntegration: true,
},
frame: true, // 去除顶部任务栏/工具栏
show: false,
icon: path.join(appInfo.home, "public", "images", "logo.png"),
};
build.json
{
"productName": "ee",
"appId": "com.electron.ee",
"copyright": "© 2024 leadzorn Technology Co., Ltd.",
"directories": {
"output": "out"
},
"asar": true,
"files": [
"**/*",
"!frontend/",
"!run/",
"!logs/",
"!go/",
"!python/",
"!data/"
],
"extraResources": {
"from": "build/extraResources/",
"to": "extraResources"
},
"nsis": {
"oneClick": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"installerIcon": "build/icons/logo.ico",
"uninstallerIcon": "build/icons/logo.ico",
"installerHeaderIcon": "build/icons/logo.ico",
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"shortcutName": "ee"
},
"mac": {
"icon": "build/icons/logo.ico",
"artifactName": "${productName}-${os}-${version}-${arch}.${ext}",
"darkModeSupport": true,
"hardenedRuntime": false
},
"win": {
"icon": "build/icons/logo.ico",
"artifactName": "${productName}-${os}-${version}-${arch}.${ext}",
"target": [
{
"target": "nsis"
}
]
},
"linux": {
"icon": "public/images",
"artifactName": "${productName}-${os}-${version}-${arch}.${ext}",
"target": [
"deb"
],
"category": "Utility"
}
}
package.json
{
"name": "ee",
"version": "1.0.0",
"homepage": "https://service.electron.build",
"description": "A fast, desktop software development framework",
"main": "main.js",
"scripts": {
"dev": "ee-bin dev",
"dev-frontend": "ee-bin dev --serve=frontend",
"dev-electron": "ee-bin dev --serve=electron",
"dev-go": "ee-bin dev --serve=go",
"dev-python": "ee-bin exec --cmds=python",
"packager": "electron-packager ./ --platform=linux --arch=x64 --overwrite",
"build-frontend": "ee-bin build --cmds=frontend && ee-bin move --flag=frontend_dist",
"build-go-w": "ee-bin move --flag=go_static,go_config,go_package,go_images && ee-bin build --cmds=go_w",
"build-go-m": "ee-bin move --flag=go_static,go_config,go_package,go_images && ee-bin build --cmds=go_m",
"build-go-l": "ee-bin move --flag=go_static,go_config,go_package,go_images && ee-bin build --cmds=go_l",
"build-python": "ee-bin build --cmds=python && ee-bin move --flag=python_dist",
"start": "ee-bin start",
"move": "ee-bin move --flag=go_static,go_config,go_package,go_images",
"rd": "ee-bin move --flag=frontend_dist",
"encrypt": "ee-bin encrypt",
"clean": "ee-bin clean",
"icon": "ee-bin icon",
"reload": "nodemon --config ./electron/config/nodemon.json",
"rebuild": "electron-rebuild",
"re-sqlite": "electron-rebuild -f -w better-sqlite3",
"build-w": "electron-builder --config=./electron/config/builder.json -w=nsis --x64",
"build-w-32": "electron-builder --config=./electron/config/builder.json -w=nsis --ia32",
"build-w-64": "electron-builder --config=./electron/config/builder.json -w=nsis --x64",
"build-w-arm64": "electron-builder --config=./electron/config/builder.json -w=nsis --arm64",
"build-we": "electron-builder --config=./electron/config/builder.json -w=portable --x64",
"build-wz": "electron-builder --config=./electron/config/builder.json -w=7z --x64",
"build-wz-32": "electron-builder --config=./electron/config/builder.json -w=7z --ia32",
"build-wz-64": "electron-builder --config=./electron/config/builder.json -w=7z --x64",
"build-wz-arm64": "electron-builder --config=./electron/config/builder.json -w=7z --arm64",
"build-m": "electron-builder --config=./electron/config/builder.json -m",
"build-m-arm64": "electron-builder --config=./electron/config/builder.json -m --arm64",
"build-l": "electron-builder --config=./electron/config/builder.json --linux=deb --x64",
"build-l-32": "electron-builder --config=./electron/config/builder.json -l=deb --ia32",
"build-l-64": "electron-builder --config=./electron/config/builder.json --linux=deb --x64",
"build-l-arm64": "electron-builder --config=./electron/config/builder.json --linux=deb --arm64",
"build-l-armv7l": "electron-builder --config=./electron/config/builder.json -l=deb --armv7l",
"build-lr-64": "electron-builder --config=./electron/config/builder.json -l=rpm --x64",
"build-lp-64": "electron-builder --config=./electron/config/builder.json -l=pacman --x64",
"test": "set DEBUG=* && electron . --env=local"
},