Hi,
Did the sw_vers command change over time in macOS? While running this on my macOS 13.4.1, I get an error running start :
./node_modules/electron-to-nwjs/node_modules/semver/classes/semver.js:38
throw new TypeError(`Invalid Version: ${version}`)
^
TypeError: Invalid Version: 13.4.1.0
at new SemVer (./node_modules/electron-to-nwjs/node_modules/semver/classes/semver.js:38:13)
at compare (./node_modules/electron-to-nwjs/node_modules/semver/functions/compare.js:3:3)
at Object.gte (./node_modules/electron-to-nwjs/node_modules/semver/functions/gte.js:2:30)
at Versions.isVersionEqualOrSuperiorThanVersion (./node_modules/electron-to-nwjs/scripts/utils/versions.js:5:23)
at currentSystemRecommendedNwjsVersion (./node_modules/electron-to-nwjs/index.js:36:23)
at Object.<anonymous> (./node_modules/electron-to-nwjs/index.js:276:62)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
Node.js v18.16.0
Output of sw_vers -productVersion on my machine:
% sw_vers -productVersion
13.4.1
Possible fix (where I count the number of dots):
const currentSystemRecommendedNwjsVersion = function () {
// Reference:
// https://dev.to/thejaredwilcurt/guide-to-nw-js-versions-5d38#osx-support
let platform = getCurrentOs();
if (platform === "mac") {
let osVersion = child_process_1.default.execSync("sw_vers -productVersion", { encoding: 'utf-8' }).toString().trim();
const dotCount = osVersion.match(/\./g).length;
const osVersionSem = osVersion + (dotCount == 1 ? ".0" : "")
if (!Versions.isVersionEqualOrSuperiorThanVersion(osVersionSem, "10.9.0")) {
// NW.js v0.14.7 and below works with 10.6+
// NW.js v0.15.0 works with 10.9+
return "0.14.7";
}
if (!Versions.isVersionEqualOrSuperiorThanVersion(osVersionSem, "10.10.0")) {
// NW.js v0.29.0 works with 10.10+
return "0.28.3";
}
if (!Versions.isVersionEqualOrSuperiorThanVersion(osVersionSem, "10.11.0")) {
// NW.js v0.51.0 works with 10.11+
return "0.50.3";
}
if (!Versions.isVersionEqualOrSuperiorThanVersion(osVersionSem, "10.15.0")) {
// NW.js v0.64.1 works with 10.15 and no longer accurately updates the plist file
return "0.64.0";
}
}
return "0.69.1";
};
In the meanwhile, the latest NW.js version is also 0.79.1
Hi,
Did the
sw_verscommand change over time in macOS? While running this on my macOS 13.4.1, I get an error runningstart:Output of
sw_vers -productVersionon my machine:Possible fix (where I count the number of dots):
In the meanwhile, the latest NW.js version is also 0.79.1