forge icon indicating copy to clipboard operation
forge copied to clipboard

You must install both Mono and Wine on non-Windows

Open guy-bartkus opened this issue 1 year ago • 3 comments

Pre-flight checklist

  • [x] I have read the contribution documentation for this project.
  • [x] I agree to follow the code of conduct that this project uses.
  • [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.6.0

Electron version

v33.2.1

Operating system

Linux Mint 22

Last known working Electron Forge version

No response

Expected behavior

npm run make -- --platform win32 should make a windows installer.

Actual behavior

Already installed wine32 and mono-xsp4 using sudo dpkg --add-architecture i386 && sudo apt install wine32 mono-xsp4, but error implies one or both is not installed.

~/Documents/Projects/Node/worldbuilder$ npm run make -- --platform win32

> [email protected] make
> electron-forge make --platform win32

✔ Checking your system
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets:
✔ Running package command
  ✔ Preparing to package application
  ✔ Running packaging hooks
    ✔ Running generateAssets hook
    ✔ Running prePackage hook
  ✔ Packaging application
    ✔ Packaging for x64 on win32 [10s]
  ✔ Running postPackage hook
✔ Running preMake hook
❯ Making distributables
  ✖ Making a squirrel distributable for win32/x64
    › You must install both Mono and Wine on non-Windows
◼ Running postMake hook

An unhandled rejection has occurred inside Forge:
Error: You must install both Mono and Wine on non-Windows
at /home/guy/Documents/Projects/Node/worldbuilder/node_modules/electron-winstaller/lib/index.js:128:31
    at step (/home/guy/Documents/Projects/Node/worldbuilder/node_modules/electron-winstaller/lib/index.js:56:23)
    at Object.next (/home/guy/Documents/Projects/Node/worldbuilder/node_modules/electron-winstaller/lib/index.js:37:53)
    at fulfilled (/home/guy/Documents/Projects/Node/worldbuilder/node_modules/electron-winstaller/lib/index.js:28:58)

My forge.config.js:

const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');

module.exports = {
	packagerConfig: {
		asar: true,
	},
	rebuildConfig: {},
	makers: [
		{
			name: '@electron-forge/maker-squirrel',
			config: {
				icon: "icons/icon.ico"
			},
		}
	],
	plugins: [
		{
			name: '@electron-forge/plugin-auto-unpack-natives',
			config: {},
		},
		// Fuses are used to enable/disable various Electron functionality
		// at package time, before code signing the application
		new FusesPlugin({
			version: FuseVersion.V1,
			[FuseV1Options.RunAsNode]: false,
			[FuseV1Options.EnableCookieEncryption]: true,
			[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
			[FuseV1Options.EnableNodeCliInspectArguments]: false,
			[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
			[FuseV1Options.OnlyLoadAppFromAsar]: true,
		}),
	],
};

Steps to reproduce

Install wine32 and mono-xsp4 using sudo dpkg --add-architecture i386 && sudo apt install wine32 mono-xsp4, then run npm run make -- --platform win32 on linux.

Additional information

No response

guy-bartkus avatar Dec 07 '24 08:12 guy-bartkus

The check in electron-winstaller is fairly naive:

  const monoExe = 'mono';
  const wineExe = ['arm64', 'x64'].includes(process.arch) ? 'wine64' : 'wine';

  if (process.platform !== 'win32') {
    useMono = true;
    const [hasWine, hasMono] = await Promise.all([
      checkIfCommandExists(wineExe),
      checkIfCommandExists(monoExe)
    ]);

    if (!hasWine || !hasMono) {
      throw new Error('You must install both Mono and Wine on non-Windows');
    }

https://github.com/electron/windows-installer/blob/4e6d76c83b2bb81e838c46c490d4e801745d2636/src/index.ts#L55-L67

Does running these commands locally work for you?

erickzhao avatar Dec 09 '24 22:12 erickzhao

I began to get this error after I updated my OS from Ubuntu 20 to 24. I was able to get the error to go away by symlinking wine64 to wine in /usr/bin/. Not sure if there's something else more proper that I should have done instead, either in the forge-config, or with some architetcure flags passed to npm run make. But this worked.

$ which wine
/usr/bin/wine
$ which wine64    # returned nothing
$ cd /usr/bin
$ sudo ln -s wine wine64
$ cd /back/to/project/directory/
$ npm run make -- --platform=win32

tuckerww avatar Dec 23 '24 19:12 tuckerww

Had this exact issue on Artix Linux. @tuckerww solution's does make the installer run, but produces a Bad EXE file. As far as I know Arch Linux does not provide wine32 and wine64 binaries separately. Any possible fixes?

mirvoxtm avatar May 19 '25 17:05 mirvoxtm