fix(build): pnpm 11 用 allowBuilds 放行 electron 安装脚本
pnpm 11 起 onlyBuiltDependencies 列表形式被静默忽略,导致 ERR_PNPM_IGNORED_BUILDS 让 pnpm run 的依赖校验直接失败(pnpm run dist 都起不来)。 改为 pnpm 自己写入的 allowBuilds 映射形式,并去掉 build.bat 里的 --ignore-scripts。 另外修复 set VAR=value && ... 的尾随空格:它会把 ELECTRON_MIRROR 变成 '.../electron/ v38.8.6/...' 从而 404。
This commit is contained in:
1 parent
52edecfa4c
commit
33d4b39eb9
2 files changed
+13
-5
No files matched your search
@@ -1,5 +1,10 @@
|
||||
onlyBuiltDependencies:
|
||||
- electron
|
||||
- electron-winstaller
|
||||
# pnpm 11 把「允许运行安装脚本的依赖」改名为 allowBuilds(列表形式的
|
||||
# onlyBuiltDependencies 会被静默忽略,导致 ERR_PNPM_IGNORED_BUILDS 让 pnpm run 直接失败)。
|
||||
allowBuilds:
|
||||
electron: true
|
||||
electron-winstaller: true
|
||||
overrides:
|
||||
# app-builder-lib@26.15.3 声明的是 ^3.0.0,但它 import 的 ElectronDownloadCacheMode
|
||||
# 只有 3.1.0 才导出,不钉死会在 pnpm run dist 时抛
|
||||
# TypeError: Cannot read properties of undefined (reading 'ReadWrite')。
|
||||
"@electron/get": 3.1.0
|
||||
+5
-2
@@ -52,7 +52,10 @@ node deploy\prepare-extra.mjs || exit /b 1
|
||||
cd console
|
||||
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
|
||||
REM console\pnpm-workspace.yaml 里的 allowBuilds 已经放行 electron 的安装脚本,
|
||||
REM 因此这里不再加 --ignore-scripts(否则 pnpm run 的依赖校验会以
|
||||
REM ERR_PNPM_IGNORED_BUILDS 失败)。
|
||||
call pnpm install --frozen-lockfile || exit /b 1
|
||||
call :ensure_electron || exit /b 1
|
||||
call pnpm run dist || exit /b 1
|
||||
cd ..
|
||||
@@ -65,7 +68,7 @@ dir /b dist\console
|
||||
endlocal
|
||||
exit /b 0
|
||||
|
||||
REM ---- ensure the electron runtime binary is present (pnpm skips its postinstall) --
|
||||
REM ---- ensure the electron runtime binary is present (fallback for mirror failures) --
|
||||
:ensure_electron
|
||||
REM path.txt tells the electron package where the binary is; without it
|
||||
REM electron-builder tries to download the runtime and hits a Node 24 bug.
|
||||
|
||||
Reference in new issue
Block a user