fix: Disable code signing to avoid Windows symlink errors

- Add signAndEditExecutable: false to skip code signing on Windows
- Clear electron-builder winCodeSign cache before build
- Add helpful error messages for symlink permission issues

The winCodeSign package contains macOS symlinks that fail to extract
on Windows without admin privileges or Developer Mode enabled.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-16 20:48:16 +08:00
parent c19b4e8292
commit 92e203422b
3 changed files with 23 additions and 1 deletions

View File

@@ -239,6 +239,13 @@ function Build-Electron {
Write-Warn "已建立 .env請確認設定"
}
# 清理可能損壞的 electron-builder 快取(解決 symlink 問題)
$ebCache = Join-Path $env:LOCALAPPDATA "electron-builder\Cache\winCodeSign"
if (Test-Path $ebCache) {
Write-Host " 清理 electron-builder 快取..." -ForegroundColor Gray
Remove-Item -Recurse -Force $ebCache -ErrorAction SilentlyContinue
}
Write-Host " 執行 electron-builder..." -ForegroundColor Gray
# 直接執行 node_modules 中的 electron-builder
@@ -246,6 +253,9 @@ function Build-Electron {
if ($LASTEXITCODE -ne 0) {
Write-Err "electron-builder 執行失敗"
Write-Warn "如果出現 symlink 錯誤,請嘗試以下方案:"
Write-Warn " 1. 以系統管理員身分執行此腳本"
Write-Warn " 2. 或啟用 Windows 開發人員模式(設定 > 更新與安全性 > 開發人員專用)"
exit 1
}