Quantcast
Channel: Electron: Crash after build exe - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Electron: Crash after build exe

$
0
0

I am tring merge wiki.js with electron
and, I can make simple electron application as below code

main.js

const { app, BrowserWindow } = require('electron');const path = require('path')var winGlobal;// This will run express server with port 3000 within 3~6 secondsrequire('./server/index.js')// load the url after 9 seconds.setTimeout(() => winGlobal.loadURL('http://localhost:3000'), 9000);function createWindow() {    const win = new BrowserWindow({        width: 1200,        height: 900,        webPreferences: {            //   preload: path.join(__dirname, 'preload.js')        }    })    winGlobal = win;}app.whenReady().then(() => {    createWindow()    app.on('activate', () => {        if (BrowserWindow.getAllWindows().length === 0) {            createWindow()        }    })})app.on('window-all-closed', () => {    if (process.platform !== 'darwin') {        app.quit()    }})

package.json

{    ..."main": "main.js"    ..."build": {"productName": "wiki.js-electron","appId": "com.electron.wiki","directories": {"output": "build"        },"asar": true    },"dependencies": {        ..."express": "4.17.1","sqlite3": "5.0.0",        ...    }"devDependencies": {        ..."electron": "^12.0.2","electron-builder": "^22.10.5",        ...    }}

And, I can run the current project with npx electron .Screen

To build exe, I can build with npx electron-build, and new exe file is generated without error log.Screen2

but, the exe is crash without any error.

How I can fix this?


Full Source code Github: https://github.com/nkhs/wiki.js-electron
Built exe: https://wetransfer.com/downloads/535a59714d4d957f478c14816ee0142e20210330143018/0d5cbe


Viewing all articles
Browse latest Browse all 2

Trending Articles