From e221c0b06b765925d045da215d4d6936369b04c7 Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Wed, 13 May 2026 22:15:46 +0700 Subject: [PATCH 01/13] chore: fix electron@41 for node 14 --- .github/workflows/tests.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 894864d..36953e1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,13 +21,9 @@ jobs: node_version: latest electron_version: latest experimental: false - - os: ubuntu-latest - node_version: 16 - electron_version: latest - experimental: false - os: ubuntu-latest node_version: 14 - electron_version: latest + electron_version: 41 experimental: true # Different electron version @@ -64,10 +60,12 @@ jobs: - run: npm config set script-shell 'bash' if: runner.os == 'Windows' - - run: npm install - - - run: npm install -D electron@${{ matrix.electron_version }} - if: matrix.electron_version != 'latest' + - run: | + if [ "${{ matrix.electron_version }}" = 'latest' ]; then + npm install + else + npm install -D electron@${{ matrix.electron_version }} + fi - run: | if [ "${RUNNER_OS}" = 'Linux' ]; then From 92b72edfb5750ebc5dc150324a7bf97fb35f12ac Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Wed, 13 May 2026 22:26:40 +0700 Subject: [PATCH 02/13] chore: try fixing electron install --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 36953e1..73b5a9b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -61,11 +61,11 @@ jobs: if: runner.os == 'Windows' - run: | - if [ "${{ matrix.electron_version }}" = 'latest' ]; then - npm install - else + if [ "${{ matrix.electron_version }}" != 'latest' ]; then npm install -D electron@${{ matrix.electron_version }} fi + npm install + node node_modules/electron/install.js - run: | if [ "${RUNNER_OS}" = 'Linux' ]; then From a078ea2161e3b54a94f37c70c3f8565bf6c8d8c3 Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Wed, 13 May 2026 22:49:56 +0700 Subject: [PATCH 03/13] chore: try fixing electron install --- .github/workflows/tests.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 73b5a9b..ab82670 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,18 +1,16 @@ name: Tests -on: - - pull_request - - push +on: push env: CI: 1 +defaults: + run: + shell: bash + jobs: main: - defaults: - run: - shell: bash - strategy: matrix: include: @@ -24,6 +22,7 @@ jobs: - os: ubuntu-latest node_version: 14 electron_version: 41 + nw_version: 0.85.0 experimental: true # Different electron version @@ -64,8 +63,12 @@ jobs: if [ "${{ matrix.electron_version }}" != 'latest' ]; then npm install -D electron@${{ matrix.electron_version }} fi + if [ -n "${{ matrix.nw_version }}" ]; then + npm install -D nw@${{ matrix.nw_version }} + fi npm install node node_modules/electron/install.js + test -f node_modules/electron/path.txt || { echo "ERROR: node_modules/electron/path.txt missing after install.js"; ls -la node_modules/electron/; exit 1; } - run: | if [ "${RUNNER_OS}" = 'Linux' ]; then From 9df2fe61e8e5710adf56081b4d57e83bf0679dfe Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Wed, 13 May 2026 23:04:40 +0700 Subject: [PATCH 04/13] chore: try fixing electron install --- .github/workflows/tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ab82670..cc66c81 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,8 +67,7 @@ jobs: npm install -D nw@${{ matrix.nw_version }} fi npm install - node node_modules/electron/install.js - test -f node_modules/electron/path.txt || { echo "ERROR: node_modules/electron/path.txt missing after install.js"; ls -la node_modules/electron/; exit 1; } + npx install-electron || echo "Skip running install-electron" - run: | if [ "${RUNNER_OS}" = 'Linux' ]; then From 7b4d3e27e6c5df05e8924bfd94bf59cd1707507f Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Wed, 13 May 2026 23:16:58 +0700 Subject: [PATCH 05/13] chore: try fixing electron install --- .github/workflows/tests.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cc66c81..9c018e1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,7 +67,23 @@ jobs: npm install -D nw@${{ matrix.nw_version }} fi npm install - npx install-electron || echo "Skip running install-electron" + if [ ! -f node_modules/electron/path.txt ]; then + cd node_modules/electron && node -e "(async () => { + const fs = require('fs'); + const path = require('path'); + const { version } = require('./package.json'); + const platformPath = process.platform === 'darwin' ? 'Electron.app/Contents/MacOS/Electron' : process.platform === 'win32' ? 'electron.exe' : 'electron'; + const { downloadArtifact } = await import('@electron/get'); + const extract = require('extract-zip'); + console.log('Downloading electron@' + version + ' for ' + process.platform + '-' + process.arch); + const zipPath = await downloadArtifact({ version, artifactName: 'electron', platform: process.platform, arch: process.arch }); + console.log('Downloaded to ' + zipPath + ', extracting...'); + await extract(zipPath, { dir: path.join(process.cwd(), 'dist') }); + await fs.promises.writeFile('path.txt', platformPath); + console.log('Wrote path.txt = ' + platformPath); + })().catch(e => { console.error(e); process.exit(1); });" && cd - + fi + test -f node_modules/electron/path.txt || { echo "ERROR: path.txt missing"; ls -la node_modules/electron/; exit 1; } - run: | if [ "${RUNNER_OS}" = 'Linux' ]; then From de7c3f663f83e14060ee8f2a4dfe5ba188b0d0a0 Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Wed, 13 May 2026 23:20:17 +0700 Subject: [PATCH 06/13] chore: try fixing electron install --- .github/workflows/tests.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9c018e1..fea8193 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -68,20 +68,20 @@ jobs: fi npm install if [ ! -f node_modules/electron/path.txt ]; then - cd node_modules/electron && node -e "(async () => { - const fs = require('fs'); - const path = require('path'); - const { version } = require('./package.json'); - const platformPath = process.platform === 'darwin' ? 'Electron.app/Contents/MacOS/Electron' : process.platform === 'win32' ? 'electron.exe' : 'electron'; + ZIPPATH=$(cd node_modules/electron && node -e "(async () => { const { downloadArtifact } = await import('@electron/get'); - const extract = require('extract-zip'); - console.log('Downloading electron@' + version + ' for ' + process.platform + '-' + process.arch); + const { version } = require('./package.json'); const zipPath = await downloadArtifact({ version, artifactName: 'electron', platform: process.platform, arch: process.arch }); - console.log('Downloaded to ' + zipPath + ', extracting...'); - await extract(zipPath, { dir: path.join(process.cwd(), 'dist') }); - await fs.promises.writeFile('path.txt', platformPath); - console.log('Wrote path.txt = ' + platformPath); - })().catch(e => { console.error(e); process.exit(1); });" && cd - + process.stdout.write(zipPath); + })().catch(e => { console.error(e); process.exit(1); });") + echo "Downloaded $ZIPPATH, extracting via system unzip..." + mkdir -p node_modules/electron/dist + unzip -q -o "$ZIPPATH" -d node_modules/electron/dist + case "$RUNNER_OS" in + Linux) echo electron > node_modules/electron/path.txt ;; + macOS) echo "Electron.app/Contents/MacOS/Electron" > node_modules/electron/path.txt ;; + Windows) echo electron.exe > node_modules/electron/path.txt ;; + esac fi test -f node_modules/electron/path.txt || { echo "ERROR: path.txt missing"; ls -la node_modules/electron/; exit 1; } From 5d74ff399e9539cf7ce3234b7c75b26aa76d5e2f Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Wed, 13 May 2026 23:24:11 +0700 Subject: [PATCH 07/13] chore: try fixing electron install --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fea8193..d1c2d94 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -78,9 +78,9 @@ jobs: mkdir -p node_modules/electron/dist unzip -q -o "$ZIPPATH" -d node_modules/electron/dist case "$RUNNER_OS" in - Linux) echo electron > node_modules/electron/path.txt ;; - macOS) echo "Electron.app/Contents/MacOS/Electron" > node_modules/electron/path.txt ;; - Windows) echo electron.exe > node_modules/electron/path.txt ;; + Linux) printf electron > node_modules/electron/path.txt ;; + macOS) printf "Electron.app/Contents/MacOS/Electron" > node_modules/electron/path.txt ;; + Windows) printf electron.exe > node_modules/electron/path.txt ;; esac fi test -f node_modules/electron/path.txt || { echo "ERROR: path.txt missing"; ls -la node_modules/electron/; exit 1; } From c5433b35fd8345ce41c2d4d4a41aca711ef705aa Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Thu, 14 May 2026 07:24:20 +0700 Subject: [PATCH 08/13] chore: try fixing electron install --- .github/scripts/install-electron.sh | 55 +++++++++++++++++++++++++++++ .github/workflows/tests.yml | 21 +++-------- 2 files changed, 59 insertions(+), 17 deletions(-) create mode 100755 .github/scripts/install-electron.sh diff --git a/.github/scripts/install-electron.sh b/.github/scripts/install-electron.sh new file mode 100755 index 0000000..438f911 --- /dev/null +++ b/.github/scripts/install-electron.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# +# Workaround: electron@42 ships without a postinstall script and lazily +# downloads its binary on the first require('electron'). Its install.js +# uses @electron/get (ESM, loaded via require(esm)) and extract-zip. On +# recent Node (observed on Node 26) the extract-zip stage silently exits +# 0 without writing node_modules/electron/path.txt, so subsequent +# require('electron') calls fail with ENOENT. +# +# This script downloads the binary with @electron/get (which works on its +# own) and extracts it with the system `unzip`, then writes path.txt the +# way install.js would have. +# +# TODO: try removing this script and the workflow call to it when +# upgrading to electron 43 or newer -- upstream may have fixed the +# install.js bug by then. + +set -euo pipefail + +ELECTRON_DIR="node_modules/electron" + +# electron <42 has a working postinstall that writes path.txt itself, so +# we only run when path.txt is missing. +if [ -f "$ELECTRON_DIR/path.txt" ]; then + exit 0 +fi + +RED='\033[1;31m' +NC='\033[0m' +ELECTRON_VERSION=$(node -p "require('./$ELECTRON_DIR/package.json').version") +printf "${RED}=====================================================================${NC}\n" +printf "${RED}WARNING: applying broken-electron-installer workaround for electron@${ELECTRON_VERSION}.${NC}\n" +printf "${RED}Try removing .github/scripts/install-electron.sh and its workflow call${NC}\n" +printf "${RED}when upgrading to electron 43 or newer.${NC}\n" +printf "${RED}=====================================================================${NC}\n" + +ZIPPATH=$(cd "$ELECTRON_DIR" && node -e "(async () => { + const { downloadArtifact } = await import('@electron/get'); + const { version } = require('./package.json'); + const zipPath = await downloadArtifact({ version, artifactName: 'electron', platform: process.platform, arch: process.arch }); + process.stdout.write(zipPath); +})().catch(e => { console.error(e); process.exit(1); });") + +echo "Downloaded $ZIPPATH, extracting via system unzip..." +mkdir -p "$ELECTRON_DIR/dist" +unzip -q -o "$ZIPPATH" -d "$ELECTRON_DIR/dist" + +case "${RUNNER_OS:-$(uname -s)}" in + Linux|Linux*) printf electron > "$ELECTRON_DIR/path.txt" ;; + macOS|Darwin*) printf "Electron.app/Contents/MacOS/Electron" > "$ELECTRON_DIR/path.txt" ;; + Windows|MINGW*|MSYS*|CYG*) printf electron.exe > "$ELECTRON_DIR/path.txt" ;; + *) echo "ERROR: unknown OS '${RUNNER_OS:-$(uname -s)}'"; exit 1 ;; +esac + +test -f "$ELECTRON_DIR/path.txt" || { echo "ERROR: path.txt missing after workaround"; ls -la "$ELECTRON_DIR/"; exit 1; } diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d1c2d94..4554d37 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,23 +67,10 @@ jobs: npm install -D nw@${{ matrix.nw_version }} fi npm install - if [ ! -f node_modules/electron/path.txt ]; then - ZIPPATH=$(cd node_modules/electron && node -e "(async () => { - const { downloadArtifact } = await import('@electron/get'); - const { version } = require('./package.json'); - const zipPath = await downloadArtifact({ version, artifactName: 'electron', platform: process.platform, arch: process.arch }); - process.stdout.write(zipPath); - })().catch(e => { console.error(e); process.exit(1); });") - echo "Downloaded $ZIPPATH, extracting via system unzip..." - mkdir -p node_modules/electron/dist - unzip -q -o "$ZIPPATH" -d node_modules/electron/dist - case "$RUNNER_OS" in - Linux) printf electron > node_modules/electron/path.txt ;; - macOS) printf "Electron.app/Contents/MacOS/Electron" > node_modules/electron/path.txt ;; - Windows) printf electron.exe > node_modules/electron/path.txt ;; - esac - fi - test -f node_modules/electron/path.txt || { echo "ERROR: path.txt missing"; ls -la node_modules/electron/; exit 1; } + # Workaround for broken electron@42 installer on modern Node. + # Remove this call when upgrading to electron 43+ and the + # upstream installer works again. + .github/scripts/install-electron.sh - run: | if [ "${RUNNER_OS}" = 'Linux' ]; then From 84ae7fa47949172e461cd1116e18f56f25e8a499 Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Thu, 14 May 2026 07:45:08 +0700 Subject: [PATCH 09/13] chore: try fixing electron install --- e2e/vite-isolation-context-sandbox/vite.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e/vite-isolation-context-sandbox/vite.config.ts b/e2e/vite-isolation-context-sandbox/vite.config.ts index 90eaf1a..e0037d4 100644 --- a/e2e/vite-isolation-context-sandbox/vite.config.ts +++ b/e2e/vite-isolation-context-sandbox/vite.config.ts @@ -31,6 +31,7 @@ export default defineConfig({ vite: mergeConfig(commonConfig, { resolve: { browserField: false, + conditions: ['node', 'module', 'import', 'require', 'default'], } }), }, From fff3bba08fa389b20aacaa0a0f721301550b9ea5 Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Thu, 14 May 2026 08:13:16 +0700 Subject: [PATCH 10/13] chore: try fixing electron install --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4554d37..d932a89 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: - os: ubuntu-latest node_version: 14 electron_version: 41 - nw_version: 0.85.0 + nw_version: 0.81.0 experimental: true # Different electron version From 5ac7fa7f2865913d0f1e2224a5b14d9cf5da885a Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Thu, 14 May 2026 08:16:01 +0700 Subject: [PATCH 11/13] chore: disable electron 16 test --- .github/workflows/tests.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d932a89..412c85f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,10 +26,6 @@ jobs: experimental: true # Different electron version - - os: ubuntu-latest - node_version: latest - electron_version: 16 - experimental: true - os: ubuntu-latest node_version: latest electron_version: 13 From 137629c845a916ddfa9e52811e901578093d3b28 Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Thu, 14 May 2026 08:18:46 +0700 Subject: [PATCH 12/13] chore: try disabling old workarounds --- .github/workflows/tests.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 412c85f..b963c31 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,7 @@ jobs: electron_version: latest experimental: true - os: windows-latest - node_version: builtin # For an unknown reason, setup-node freezes + node_version: latest electron_version: latest experimental: true @@ -46,11 +46,10 @@ jobs: continue-on-error: ${{ matrix.experimental }} steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 with: node-version: ${{ matrix.node_version }} - if: matrix.node_version != 'builtin' - run: npm config set script-shell 'bash' if: runner.os == 'Windows' From 0696b6c0fbbd7028a70e20896cd41b8e7e55a75f Mon Sep 17 00:00:00 2001 From: Alex Prokhorov Date: Thu, 14 May 2026 08:24:04 +0700 Subject: [PATCH 13/13] chore: try disabling old workarounds --- .github/workflows/tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b963c31..2086dee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,9 +51,6 @@ jobs: with: node-version: ${{ matrix.node_version }} - - run: npm config set script-shell 'bash' - if: runner.os == 'Windows' - - run: | if [ "${{ matrix.electron_version }}" != 'latest' ]; then npm install -D electron@${{ matrix.electron_version }}