#1127·nexe

Generate executable from macOS for Windows

Author: balenaultraCreated Mar 13, 2025Updated Sep 5, 2026

I'm working on macOS and I need to generate an executable for Windows.

I can currently do this because I point to another repository and download version 18 of node, but my projects are all running on versions 20/22.

If I use build: true, the executable is generated for mac, not for windows.

How can I generate executables in more recent versions of node?

If I need to generate node on another windows pc, I have access, that's not a problem, I just don't know how to generate it.

I just don't want to have to generate the exe for each application on windows every time I need it.

Below is my current script

const { compile } = require('nexe');

const { nexe, version, name: appName, description } = require('../package.json');
const ver = version + '.0';

const rc = {
  CompanyappName: appName,
  ProductappName: appName,
  FileDescription: description || appName,
  FileVersion: ver,
  ProductVersion: ver,
  OriginalFileappName: appName + '.exe',
  InternalappName: appName,
  ProductName: appName,
  LegalCopyright: `© ${new Date().getFullYear()} ${nexe.authorName}`
};

compile({
  input: './dist/main.js',
  output: './target/MyMexecutable.exe',
  target: 'windows-x64-18.14.0',
  python: '/usr/local/bin/python3',
  remote: 'https://github.com/urbdyn/nexe_builds/releases/download/0.3.0/',
  resources: [
    './node_modules/rxjs',
    './node_modules/tinycolor2',
    './node_modules/parse5',
    './node_modules/parse5-htmlparser2-tree-adapter',
    './node_modules/cheerio',
    './node_modules/vm2',
    './node_modules/swagger-ui-dist',
    './package.json'
  ],
  clean: false,
  //loglevel: 'verbose',
  temp: './build_temp',
  rc: Object.assign(
    {
      ProductVersion: '1,0,0,0',
      FILEVERSION: ver
    },
    rc
  )
}).then(() => {
  console.log('[+] Successful build.');
});

The "rc" property is there in an unsuccessful attempt, it was left behind...