Piero Pajares
Piero Pajares

Reputation: 277

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

Upvotes: 3

Views: 7626

Answers (2)

Mateusz Grzonka
Mateusz Grzonka

Reputation: 61

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

Upvotes: 2

Brian Chandler
Brian Chandler

Reputation: 180

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.

Upvotes: 8

Related Questions