Electron项目生成Debian安装包时遇二进制文件找不到错误求助
Hey there, let's sort out that deb packaging error you're hitting with your Electron app! That Error: could not find the Electron app binary at "dist/app-linux-x64/koriwallet" message is telling us that electron-installer-debian can't locate your app's executable file in the path you specified, and it's because of a mismatch between your packaging setup and the deb builder's expectations. Let's break down the fixes:
First, understand the root cause
Looking at your package.json:
- Your
electron-packagerbuild script iselectron-packager . myapp, which generates a folder namedmyapp-linux-x64insidedist/(notapp-linux-x64like yourdeb64script references). - You've set
"executableName": "kori"inelectronPackagerConfig, so your app's binary is namedkori— notkoriwalletwhich the deb installer is looking for by default.
Fix Option 1: Tweak electron-packager + electron-installer-debian setup
You have two sub-options here to align the paths and filenames:
Sub-option 1a: Match the deb installer's expected binary name
Update your build script to name your packaged app and binary koriwallet directly:
"scripts": { "build": "electron-packager . koriwallet --out dist" }
This will generate dist/koriwallet-linux-x64/koriwallet, which matches what the deb installer expects. Then update your deb64 script to point to the correct folder:
"deb64": "electron-installer-debian --src dist/koriwallet-linux-x64/ --dest dist/installers/ --arch amd64"
Run npm run build first, then npm run deb64 to generate your deb file.
Sub-option 1b: Keep your custom executable name
If you want to keep the binary named kori, just tell electron-installer-debian exactly where to find it with the --bin flag:
"deb64": "electron-installer-debian --src dist/myapp-linux-x64/ --dest dist/installers/ --arch amd64 --bin kori"
Again, run npm run build followed by npm run deb64 to get your deb package.
Fix Option 2: Use electron-builder directly (recommended)
You already have electron-builder installed, and it can handle deb packaging natively — no need for electron-installer-debian at all. This is simpler and less error-prone:
- Update your
buildconfiguration anddistscript inpackage.json:
"scripts": { "dist": "electron-builder --linux deb" }, "build": { "appId": "com.yourdomain.koriwallet", // Use a reverse-domain style ID for best practices "linux": { "category": "Finance", // More accurate category for a wallet app "target": "deb", "executableName": "koriwallet" // Set your desired binary name here } }
- Run
npm run dist— electron-builder will handle the entire packaging process and drop your amd64 deb file right into thedistfolder.
Pro tip: Before re-running any packaging commands, delete the dist folder to clear out old cached files that might cause conflicts.
内容的提问来源于stack exchange,提问作者Suman Raj

