Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: github actions for windows

Ilian Sapundshiev3383ed172932
diff --git a/.erb/scripts/electron-rebuild.js b/.erb/scripts/electron-rebuild.js
index 0bea32793..3b42998ac 100644
--- a/.erb/scripts/electron-rebuild.js
+++ b/.erb/scripts/electron-rebuild.js
@@ -1,5 +1,6 @@
import { execSync } from 'child_process';
import fs from 'fs';
+import path from 'path';
import { dependencies } from '../../release/app/package.json';
import webpackPaths from '../configs/webpack.paths';
@@ -7,8 +8,23 @@ if (
Object.keys(dependencies || {}).length > 0 &&
fs.existsSync(webpackPaths.appNodeModulesPath)
) {
- const electronRebuildCmd =
- '../../node_modules/.bin/electron-rebuild --force --types prod,dev,optional --module-dir .';
+ // Read electron version explicitly to avoid "Unable to find electron's version number" on Windows
+ const electronPkgPath = path.resolve(
+ __dirname,
+ '..',
+ '..',
+ 'node_modules',
+ 'electron',
+ 'package.json',
+ );
+ let electronVersion = '';
+ try {
+ const electronPkg = JSON.parse(fs.readFileSync(electronPkgPath, 'utf-8'));
+ electronVersion = ` -v ${electronPkg.version}`;
+ } catch (e) {
+ console.warn('Could not read electron version from', electronPkgPath);
+ }
+ const electronRebuildCmd = `../../node_modules/.bin/electron-rebuild --force --types prod,dev,optional --module-dir .${electronVersion}`;
const cmd =
process.platform === 'win32'
? electronRebuildCmd.replace(/\//g, '\\')