From c55ff0da19efba2147fb6b18f51fe8e601e22e71 Mon Sep 17 00:00:00 2001 From: CyanSalt Date: Sun, 29 Sep 2024 21:02:17 +0800 Subject: [PATCH] fix: electron version script --- build/utils/get-versions.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build/utils/get-versions.mjs b/build/utils/get-versions.mjs index 75df41aa..666b2839 100644 --- a/build/utils/get-versions.mjs +++ b/build/utils/get-versions.mjs @@ -1,12 +1,14 @@ import path from 'node:path' -import url from 'node:url' import { execa } from './child-process.mjs' import { getDirectory } from './common.mjs' export default async function () { - const resolved = import.meta.resolve('electron/cli.js') - const electron = url.fileURLToPath(resolved) const versionScript = path.resolve(getDirectory(import.meta), 'electron-versions.cjs') - const { stdout: versions } = await execa(`node ${electron} ${versionScript}`) + const { stdout: versions } = await execa(`npx electron ${versionScript}`, { + env: { + ...process.env, + ELECTRON_RUN_AS_NODE: '1', + }, + }) return JSON.parse(versions) }