Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build executable for windows with Vue CLI Plugin Electron Builder in linux

I'm trying to build an executable file for windows from my linux but so far I have not been able to do it.

According to the documentation, it tells me that here I could configure, for example, the output folder.

pluginOptions: {
    electronBuilder: {
      outputDir: 'desktop-for-windows',
    },
  },

and if it works but does not say anything about how to change the platform (s.o) to build. also try testing the following command:

npm run electron:build --win

but by default it builds for linux

like image 925
Piero Pajares Avatar asked Mar 06 '26 07:03

Piero Pajares


2 Answers

Ran into same thing trying to move from an older boiler plate to using Vue-CLI 3 just now.

Run this from within the project directory and see if it works:
./node_modules/.bin/vue-cli-service electron:build --windows

I got the --windows from the ui.js file in the vue-cli-plugin-electron-builder directory under node_modules. Other options are --linux and --macos. I'm surprised I don't see a --all flag or that all isn't the default.

If you add "build:win": "vue-cli-service electron:build --windows" under scripts in your package.json then you can instead run npm run build:win from there on.

like image 189
Brian Chandler Avatar answered Mar 08 '26 19:03

Brian Chandler


I just faced the same problem and found pretty easy answer. You can just run npm run electron:build -- --linux deb --win nsis in the project directory.

There is more about it here: https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/recipes.html#multi-platform-build

like image 28
Mateusz Grzonka Avatar answered Mar 08 '26 19:03

Mateusz Grzonka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!