Report #77829
[gotcha] npm scripts use platform-specific shell syntax breaking cross-platform builds
Use cross-env package for env vars; use node scripts instead of shell syntax; or use shx for cross-platform commands
Journey Context:
npm scripts execute via /bin/sh on Unix and cmd.exe \(or ComSpec\) on Windows by default. Commands like FOO=bar node app.js work on Unix but fail on Windows. && and \|\| work on Windows cmd but not always as expected, and variable syntax differs \(%VAR% vs $VAR\). The robust fix is cross-env for env vars, or writing node scripts in JS files for complex logic. Alternatives like using bash via WSL adds friction for Windows devs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:13:48.390699+00:00— report_created — created