Reputation: 2702
I am trying to make an executable Electron App. I am developing on an OpenSuse Leap 15.1 host platform (Linux). I am trying to build for win32 but, it's giving me the following error:
2020-11-04 08:44:08> Unhandled exception: System.IO.FileNotFoundException: Could not load file or assembly 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
File name: 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at Squirrel.Update.Program.main (System.String[] args) [0x00060] in <9e2ab352f8944769b3794933dd42e8f9>:0
2020-11-04 08:45:20> Unhandled exception: System.IO.FileNotFoundException: Could not load file or assembly 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
File name: 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at Squirrel.Update.Program.main (System.String[] args) [0x00060] in <9e2ab352f8944769b3794933dd42e8f9>:0
Here's my package.json file:
{
"name": "mailer-boy",
"version": "1.0.0",
"description": "An email client for IMAP server",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.54",
"@electron-forge/maker-deb": "^6.0.0-beta.54",
"@electron-forge/maker-rpm": "^6.0.0-beta.54",
"@electron-forge/maker-squirrel": "^6.0.0-beta.54",
"@electron-forge/maker-zip": "^6.0.0-beta.54",
"electron": "^10.1.5",
"electron-winstaller": "^4.0.1"
},
"dependencies": {
"base64-stream": "^1.0.0",
"electron-squirrel-startup": "^1.0.0",
"html-to-text": "^6.0.0",
"node-imap": "^0.9.6",
"underscore": "^1.11.0"
},
"config": {
"forge": {
"packagerConfig": {},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "mailer_boy"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "@electron-forge/maker-deb",
"config": {}
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
}
]
}
}
}
And here are the commands I tried:
> npm run make --targets @electron-forge/maker-squirrel
> npm run make --platform linux --targets win32
The commands above kept ignoring the target and just built an application for Linux (after adding the deb and rpm packages). I also tried this:
winstaller.js
const createWindowsInstaller = require('electron-winstaller').createWindowsInstaller
const path = require('path')
getInstallerConfig()
.then(createWindowsInstaller)
.catch((error) => {
console.error(error.message || error)
process.exit(1)
})
function getInstallerConfig () {
console.log('creating windows installer')
const rootPath = path.join('./')
const outPath = path.join(rootPath, 'out')
return Promise.resolve({
appDirectory: path.join(outPath, 'mailer-boy-linux-x64'),
authors: 'Abrar H Galib',
noMsi: true,
outputDirectory: path.join(outPath, 'windows-installer'),
exe: 'mailerboy.exe',
setupExe: 'MailerboyInstaller.exe',
});
}
Running the above with Node.js gives the error given above. How can I target Win32 from my platform? Am I missing any dependencies? I installed dotnet-sdk, dotnet-runtime but that didn't help. Thanks.
Edit
I ended up using a friend's Windows laptop for building the app for Windows. It was somewhat painful. I would very much like to know if building for Windows and MacOS is even possible from Linux. If not, it will be somewhat inconvenient (and also useless) to keep using Electron.
Upvotes: 0
Views: 3354
Reputation: 95
I'm also building an electron app on macOS for cross-platform, I also faced the same problem but after research, I found one way that I would like to share with you,
As of now I don't see any way to build cross-platform distributable from MacOS itself it'll throw an error as below via using this command electron-forge make -- --platform win32
Solutions:
But there is an alternative solution you can try is using electron-builder
You can install electron-builder globally/locally and can use npx electron-builder
its strongly recommended via yarn to install, but I choose npm you can go with whatever you prefer
Checkout documentation of electron-builder CLI Options: https://www.electron.build/cli
You can build for cross-platform by using npx electron-builder -mwl
where options stand for m for MacOS, w for Windows, and l for Linux
Update v1:
You can make a cross-platform app with npm run make -- --platform
but at first your Mac system should be installed with mono
and wine
package in order to make the app for platform specific.
Upvotes: 0