Skip to content

Windows support for the Remotion workspace: npm, vite and remotion spawns - #20

Open
simplaerai-sv wants to merge 1 commit into
HelpFreedom:mainfrom
simplaerai-sv:win32-fragments
Open

Windows support for the Remotion workspace: npm, vite and remotion spawns#20
simplaerai-sv wants to merge 1 commit into
HelpFreedom:mainfrom
simplaerai-sv:win32-fragments

Conversation

@simplaerai-sv

Copy link
Copy Markdown

What

Remotion fragments (auto-captions, animations) never worked on Windows:
electron/fragments.ts spawns npm, sh -c … vite … and npx remotion,
all POSIX-only. One file changed, win32 branches only; the POSIX path —
including the vite watchdog — is untouched.

Symptoms

  • first fragment ever: fragment:ensurespawn npm ENOENT
  • with dependencies installed by hand: creation works, but every export
    containing a fragment fails at render (spawn npx ENOENT)

On Windows npm/npx are .cmd shims, which spawn does not resolve
without a shell — and since CVE-2024-27980 node refuses to spawn a .cmd
without shell: true anyway. There is no sh.

Changes

  • npm installnpm.cmd with shell: true. The argv is a constant
    (install --no-audit --no-fund), so a shell is safe here.
  • vite dev servernode node_modules/vite/bin/vite.js --port … --strictPort,
    no watchdog. An orphan left by a hard exit is tolerated by design:
    probeExisting() adopts a server from a previous run instead of fighting
    it for the port.
  • remotion rendernode node_modules/@remotion/cli/remotion-cli.js render …,
    the CLI's own JS entry. Skips npx's startup and its network probe too.

All three use windowsHide: true so no console windows flash.

Tested

Windows 11, Node 24, remotion 4.0.247, vite 5.4.8, RTX 4060:

  • three transparent caption fragments (60 s each, 1080×1920) created,
    rendered (VP9+alpha) and exported through the normal pipeline
  • vite dev server starts and serves the player page
  • fragment render cache (userData/fragment-renders) populated as usual

Render cost is unchanged from POSIX — Remotion at 60 fps is the slow part
(~4 min per 60-second transparent fragment on this machine), not the spawn.

Sits alongside #7 (embedded Claude on Windows) and #19 (GPU transcription);
no file overlap with either or with #9.

🤖 Generated with Claude Code

…awns

electron/fragments.ts spawned 'npm', 'sh -c … vite …' and 'npx remotion',
all POSIX-only: on Windows npm/npx are .cmd shims (spawn ENOENT, and node
refuses .cmd without a shell since CVE-2024-27980), and there is no sh.
So the first fragment failed at 'fragment:ensure' and every export with a
fragment would have failed at render.

win32 branches, POSIX path untouched:
- npm install: npm.cmd via shell (constant argv, so a shell is safe)
- vite dev server: node node_modules/vite/bin/vite.js, no watchdog — an
  orphan from a hard exit is adopted by probeExisting() on the next run
- remotion render: node node_modules/@remotion/cli/remotion-cli.js — the
  CLI's JS entry, which also skips npx's startup and network probe

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant