electron + vue /打包linux应用报错记录(长期施工中)


# electron + vue 打包linux应用报错记录
## icon图标导致的报错
```txt
  ⨯ 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.14.5/libexec/src/runtime/proc.go:203
runtime.goexit
    /usr/local/Cellar/go/1.14.5/libexec/src/runtime/asm_amd64.s:1373  
  ⨯ Cannot cleanup: 
 
Error #1 --------------------------------------------------------------------------------
Error: /root/node/lib/node_modules/electron-builder/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
    at ChildProcess.<anonymous> (/root/node/lib/node_modules/electron-builder/node_modules/builder-util/src/util.ts:243:14)
    at Object.onceWrapper (events.js:422:26)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
 
Error #2 --------------------------------------------------------------------------------
Error: /root/node/lib/node_modules/electron-builder/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
    at ChildProcess.<anonymous> (/root/node/lib/node_modules/electron-builder/node_modules/builder-util/src/util.ts:243:14)
    at Object.onceWrapper (events.js:422:26)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)  stackTrace=
```
### win打包的应用图标,在vue.config.js这样设置就ok

![win.png](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/b29e7063c09a4b3d9472cc74ce867fd1~tplv-k3u1fbpfcp-watermark.image?)

>但是在linux中这样打包必定爆上面的错误

### 在linux中必需
- 先在**background.js**中创建窗口时引入一张图标
![back.png](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/f777f2c05c1b4b3a8b41003c4711ee3e~tplv-k3u1fbpfcp-watermark.image?)
- 然后再到**vue.config.js**中

![linux.png](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/504bf6194e1146de9d28f2a0fb3d6bae~tplv-k3u1fbpfcp-watermark.image?)
>这里十分奇怪为何引入的只是**文件夹而不是文件**
[参考的文章https://blog.csdn.net/chenqk_123/article/details/112962391](https://blog.csdn.net/chenqk_123/article/details/112962391)

上一篇:MAYA运行单个MEL命令方法图文介绍


下一篇:SpringCloud--actuator微服务信息完善