From d5b45761d7bcd52bd2ad31eced1e635ddd6f66c1 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Wed, 9 Sep 2026 21:11:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(build):=20=E6=81=A2=E5=A4=8D=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E6=94=BE=E7=BD=AE=20Electron=20=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E6=AD=A5=E9=AA=A4=EF=BC=88electron-builder?= =?UTF-8?q?=20=E8=87=AA=E4=B8=8B=E4=BC=9A=E6=92=9E=20Node=2024=20bug?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/build.bat | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/deploy/build.bat b/deploy/build.bat index 3781eba..60a67c3 100644 --- a/deploy/build.bat +++ b/deploy/build.bat @@ -50,9 +50,10 @@ taskkill /im scoreboard.exe /f >nul 2>&1 if not exist "rules" echo [warn] rules dir missing node deploy\prepare-extra.mjs || exit /b 1 cd console -REM pnpm 11 blocks postinstall by default; electron-builder fetches its own Electron -REM runtime into its cache, so skipping scripts here is safe (and avoids ERR_PNPM_IGNORED_BUILDS). +REM pnpm 11 blocks postinstall by default (ERR_PNPM_IGNORED_BUILDS), so the electron +REM runtime binary is fetched explicitly below instead of relying on the install script. call pnpm install --frozen-lockfile --ignore-scripts || exit /b 1 +call :ensure_electron || exit /b 1 call pnpm run dist || exit /b 1 cd .. @@ -63,3 +64,15 @@ echo dist\console\ console installer + portable dir /b dist\console endlocal exit /b 0 + +REM ---- ensure the electron runtime binary is present (pnpm skips its postinstall) -- +:ensure_electron +if exist node_modules\electron\dist\electron.exe exit /b 0 +set "EV=38.8.6" +echo downloading electron %EV% ... +curl -L --fail --max-time 900 -o electron-dl.zip "%ELECTRON_MIRROR%%EV%/electron-v%EV%-win32-x64.zip" || exit /b 1 +powershell -NoProfile -Command "Expand-Archive -LiteralPath 'electron-dl.zip' -DestinationPath 'node_modules/electron/dist' -Force" || exit /b 1 +del /q electron-dl.zip +echo electron.exe> node_modules\electron\path.txt +echo electron runtime ready +exit /b 0