Original Error: "Error launching app. Unable to find Electron app at .../builder"
Root Cause: The build system was already functional. The error was likely due to running electron-builder without first compiling the application with npm run build, or having incomplete artifacts in dist/ or dist-electron/.
{
"name": "opius",
"private": true,
"version": "1.0.0",
+ "description": "Opius Workspace - AI-powered development environment",
+ "author": {
+ "name": "Opius Team",
+ "email": "contact@opius.dev"
+ },
+ "homepage": "https://github.com/opius-workspace/opius",
"type": "module",
"scripts": {
"dev": "vite",
- "build": "tsc && vite build && node scripts/validate-preload.mjs && electron-builder",
+ "build": "tsc && vite build && node scripts/validate-preload.mjs",
+ "package": "npm run build && electron-builder",
+ "package:linux": "npm run build && electron-builder --linux",
+ "package:win": "npm run build && electron-builder --win",
+ "package:mac": "npm run build && electron-builder --mac",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
}, "extraResources": [
{
"from": "resources/whisper",
"to": "whisper",
"filter": [...]
}
- ]
+ ],
"mac": {
"target": ["dmg"],
...
},
...
"linux": {
"target": [
- "AppImage"
+ "AppImage",
+ "deb"
],
"artifactName": "${productName}-Linux-${version}.${ext}",
- "icon": "src/assets/opius-icon.png"
+ "icon": "src/assets/opius-icon.png",
+ "category": "Development"
} getDefaultShell(): string {
+ const platform = os.platform()
+
- if (os.platform() === 'win32') {
+ if (platform === 'win32') {
return 'powershell.exe'
+ } else if (platform === 'darwin') {
+ // macOS: prefer zsh (default since Catalina), fallback to bash
+ return process.env.SHELL || '/bin/zsh'
+ } else {
+ // Linux and others: prefer bash
+ return process.env.SHELL || '/bin/bash'
}
- return process.env.SHELL || '/bin/bash'
}npm run build- Compiles TypeScript
- Bundles frontend (Vite →
dist/) - Bundles Electron (→
dist-electron/) - Validates preload scripts
Linux (AppImage + DEB):
npm run package:linuxWindows (NSIS installer):
npm run package:winmacOS (DMG):
npm run package:macCurrent Platform (auto-detect):
npm run packagerelease/1.0.0/Opius-Linux-1.0.0.AppImage(~431 MB)release/1.0.0/Opius-Linux-1.0.0.deb(~250 MB)
release/1.0.0/Opius-Windows-1.0.0-Setup.exe
release/1.0.0/Opius-Mac-1.0.0-Installer.dmg
| Platform | Shell | Location |
|---|---|---|
| Windows | PowerShell | powershell.exe |
| macOS | Zsh | /bin/zsh |
| Linux | Bash | /bin/bash |
| Platform | Path |
|---|---|
| Windows | %APPDATA%\Opius\ |
| macOS | ~/Library/Application Support/Opius/ |
| Linux | ~/.config/Opius/ |
| Platform | Command |
|---|---|
| Windows | where <exe> |
| Linux/macOS | which <exe> |
✅ Linux Build: Tested successfully on Linux Mint
✅ No Hardcoded Windows Paths: Verified via grep
✅ Platform-Aware Shell Selection: Implemented
✅ Cross-Platform Path Handling: Uses Node.js path module
⏳ Windows Build: Configuration ready, untested
⏳ macOS Build: Configuration ready, untested
package.json- Metadata and scriptselectron-builder.json5- Build configurationelectron/terminalManager.ts- Shell detectionBUILD_GUIDE.md- New comprehensive guideCHANGES_SUMMARY.md- This file
The codebase already properly handles:
- ✅ Platform detection via
process.platform - ✅ Path construction via
path.join() - ✅ User data directories via
app.getPath() - ✅ Resource paths via
process.resourcesPath - ✅ Command execution with platform checks
The build system was already cross-platform compatible. The changes made were:
- Organizational improvements (separated build/package)
- Metadata additions (for deb package requirements)
- Enhanced macOS support (explicit zsh detection)
- Better documentation
The original error was likely a workflow issue (running electron-builder before building), not a configuration problem.