.deb generated by electron-builder for a simple Electron app fails to install in Ubuntu Software

Viewed 372

electron-builder successfully generates working dmg, Windows exe, and AppImage files for my app but the deb file produces this output in Ubuntu Software when I double click on it: "Failed to install file: not supported"

So I tried to distill the problem and ended up stripping my app down to the most minimalist Electron app... This is literally my folder structure now:

main.js
package.json
public/
├─ index.html

This is main.js:

// this template follows the electron docs
const { app, BrowserWindow } = require('electron')
const { join } = require('path')

const createWindow = () => {
    const mainWindow = new BrowserWindow()
    mainWindow.loadFile(join(__dirname, 'public', 'index.html'))
}

app.whenReady().then(() => {
    createWindow()
    app.on('activate', () => {
        if (BrowserWindow.getAllWindows().length === 0) createWindow()
    })
})

app.on('window-all-closed', () => {
    if (process.platform !== 'darwin') app.quit()
})

This is package.json:

{
    "name": "myapp",
    "version": "1.0.0",
    "description": "A creative description",
    "homepage": "https://example.com",
    "author": {
        "name": "John Doe",
        "url": "https://example.com",
        "email": "johndoe@example.com"
    },
    "private": true,
    "license": "UNLICENSED",
    "main": "main.js",
    "scripts": {
        "start": "electron main.js"
    },
    "devDependencies": {
        "electron": "^17.0.0",
        "electron-builder": "^22.14.13"
    },
    "build": {
        "appId": "com.electron.Myapp",
        "productName": "Myapp",
        "artifactName": "Myapp",
        "linux": {
            "target": "deb",
            "category": "Office"
        }
    }
}

And this is public/index.html:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Keymaker</title>
    </head>
    Hi
</html>

npm start produces a working app with a window that just says "Hi". Replacing "deb" with "AppImage" in package.json and running npx electron-builder -l makes a working executable—just double click and it loads. But for some reason the deb file doesn't. What do I need to do?

0 Answers
Related