AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Windows: Pnpm Dev Fails Due To Unix-Style NODE_OPTIONS Environment Variable Assignment In Package.Json Scripts

Running `pnpm dev` on Windows 11 fails because Supabase monorepo scripts use inline `NODE_OPTIONS=...` syntax, which is interpreted as a command by cmd.exe, producing `NODE_OPTIONS is not recognized as an internal or external command`. This blocks local development for Windows contributors.

mediumConfidence 65%Supabase

Origin Analysis

The package.json scripts (likely the root `dev` script) set the `NODE_OPTIONS` environment variable using Unix shell syntax (`NODE_OPTIONS=--max-old-space-size=4096 ...`). Windows Command Prompt does not support inline environment variable assignment before a command; it treats `NODE_OPTIONS` as a separate command and fails. This is a cross-platform scripting defect in the monorepo tooling.
1. Clone the supabase/supabase repository on a Windows 11 machine. 2. Run `pnpm install` to install dependencies. 3. Run `pnpm dev`. 4. Observe the error: `NODE_OPTIONS is not recognized as an internal or external command, operable program or batch file.`

Fixing Code Block

{ "scripts": { "dev": "cross-env NODE_OPTIONS=--max-old-space-size=4096 turbo run dev --parallel" }, "devDependencies": { "cross-env": "^7.0.3" } }
Install the `cross-env` package as a dev dependency and prefix any script that sets `NODE_OPTIONS` with `cross-env`. This wrapper translates the environment variable assignment into a form compatible with Windows cmd.exe, PowerShell, and Unix shells. Apply the same change to all package.json files in the monorepo that use inline `NODE_OPTIONS`.

Edge Case Audit

Do not blindly replace all occurrences of `NODE_OPTIONS=` if some scripts already use `cross-env` or other Windows-specific wrappers; verify each script first. Adding `cross-env` as a dependency may require a lockfile update and `pnpm install`. On Windows, also ensure Developer Mode is enabled to allow pnpm symlinks. Rollback is safe by reverting to the previous package.json and removing `cross-env` from devDependencies.

Ecosystem Topology