You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Builds that set NODE_OPTIONS fail on macOS because Electron ignores it in the app's Node children #525
On macOS, "Apply and rebuild" on an older Gutenberg pull request (reproduced with gutenberg#76292, based on March 2026 trunk) fails with:
Build failed: Command failed: npm run --if-present --workspaces --silent build
--silent hides the real error. Without it, @wordpress/theme's build:tokens fails:
[ERROR:electron/shell/app/node_main.cc:153] Node.js environment variables are disabled because this process is invoked by other apps.
✗ [config] Cannot find module '.../packages/theme/bin/terrazzo-plugin-mode-overrides/index'
Why
That script runs cross-env NODE_OPTIONS=--import=esbuild-esm-loader/register tz build --config terrazzo.config.ts, so tz needs the --import to load a .ts config.
tz starts through our node shim, a bash script that execs the app binary with ELECTRON_RUN_AS_NODE=1.
On macOS, Electron ignores NODE_OPTIONS when the process was launched by something outside the app. Its parent here is bash, so the --import is dropped.
Gutenberg trunk dropped NODE_OPTIONS from this script in af9f99d757 (Terrazzo 2.0, 17 Apr 2026), so only pull requests based on older trunk hit it.
macOS only. Windows passes NODE_OPTIONS to children already (win-spawn-patch).
Proposed fix
On macOS, the node shim passes the incoming NODE_OPTIONS as CLI flags ahead of the script. Checked by hand on a copy of the site: with $NODE_OPTIONS before "$@" in the shim, the same build exits 0. Quoting inside NODE_OPTIONS needs care, plus tests in tests/unit/node-shims.test.cjs.
Activity
[Fix] Pass NODE_OPTIONS to Electron as arguments in the macOS shims (W…