- Fix build cache check: use "node -" with process.argv instead of
"node -e" with interpolated paths (MSYS2 path style breaks require())
- Fix unbound variable error: use ${OPENCLAW_FORCE_BUILD:-} for set -u
- Remove slow `du -sh` at end of build script (extremely slow on Windows)
- Use NTFS junction (Windows) / symlink (macOS/Linux) instead of
fs.cpSync for near-instant runtime sync
- Fix asar extraction: preserve backslash paths for extractFile() lookup
- Fix gateway-launcher.cjs: use fs.realpathSync to resolve junctions
when comparing process.argv[1] with __filename
- Fix client module loading: use require(path) instead of
import(file://url) since TypeScript CJS output downgrades import()
to require() which doesn't support file:// URLs
- Increase gateway boot timeout from 120s to 180s
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Three issues prevented the gateway from starting on Windows after a fresh
runtime build:
1. The build script packs openclaw.mjs and dist/ into gateway.asar then
deletes the originals, but utilityProcess.fork() cannot load ESM from
inside .asar archives on Windows. Added auto-extraction of bare entry
files from gateway.asar at startup (ensureBareEntryFiles) and at
build-time (sync-openclaw-runtime-current.cjs).
2. The ESM loader misinterprets Windows drive letters (e.g. "D:") as URL
schemes, causing ERR_UNSUPPORTED_ESM_URL_SCHEME. Added a CJS wrapper
(gateway-launcher.cjs) that uses pathToFileURL() to load the ESM entry
via a proper file:// URL.
3. OpenClaw's isMainModule() guard checks process.argv[1] basename against
known entry pairs. The CJS wrapper patches argv[1] back to the ESM
entry path so the guard recognizes it as the main module.
Co-Authored-By: Claude Opus 4.6 <[email protected]>