Use Electron binary for export task to avoid system-wide node dependency

This commit is contained in:
sudipnext 2026-03-20 13:32:02 +05:45
parent 78569a9cb0
commit fd70d8de7a

View file

@ -54,11 +54,14 @@ export function setupExportHandlers() {
NEXT_PUBLIC_URL: process.env.NEXT_PUBLIC_URL,
NEXT_PUBLIC_FAST_API: process.env.NEXT_PUBLIC_FAST_API,
});
const exportTaskProcess = spawn("node", [exportScriptPath, exportTaskPath], {
// Use the current Electron binary in Node-compatible mode so export does
// not depend on a system-wide `node` being available in PATH.
const exportTaskProcess = spawn(process.execPath, [exportScriptPath, exportTaskPath], {
stdio: ["ignore", "pipe", "pipe"],
cwd: baseDir,
env: {
...process.env,
ELECTRON_RUN_AS_NODE: "1",
TEMP_DIRECTORY: tempDir,
APP_DATA_DIRECTORY: appDataDir,
NODE_ENV: "development",