Skip to content

fix(embed): resolve npx absolute path on Windows before spawning UI#1682

Merged
nicoloboschi merged 1 commit into
vectorize-io:mainfrom
tuancookiez-hub:fix-windows-npx-detached-process
May 25, 2026
Merged

fix(embed): resolve npx absolute path on Windows before spawning UI#1682
nicoloboschi merged 1 commit into
vectorize-io:mainfrom
tuancookiez-hub:fix-windows-npx-detached-process

Conversation

@tuancookiez-hub
Copy link
Copy Markdown
Contributor

@tuancookiez-hub tuancookiez-hub commented May 21, 2026

Problem

On Windows 11, running hindsight-embed -p <profile> ui start in local/embedded mode fails with:

Command not found: npx

even when npx is installed and available in the user's PATH.

Root Cause

subprocess.Popen() with creationflags=DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP on Windows spawns a process that does not inherit the parent's PATH environment. The bare string npx cannot be resolved in the detached process context.

Fix

Use shutil.which("npx") to resolve the absolute path to npx before spawning the subprocess. Falls back to the bare npx command so that existing FileNotFoundError error handlers can still report the missing command cleanly.

Changes

  • hindsight-embed/hindsight_embed/daemon_embed_manager.py: _find_ui_command() method

Testing

  • Verified on Windows 11 with PowerShell / Git Bash
  • npx resolves to C:\Program Files\nodejs\npx.cmd
  • UI starts successfully after the fix
  • Fallback still produces clean error when npx is truly missing
  • Original behavior preserved: daemon starts in popup terminal, UI runs in foreground with Ctrl+C support

Fixes #1681

On Windows, subprocess.Popen with DETACHED_PROCESS does not inherit
the parent's PATH, causing 'Command not found: npx' even when npx
is installed and available in the shell.

Use shutil.which('npx') to resolve the absolute path before passing
it to subprocess. Falls back to bare 'npx' so FileNotFoundError
handlers can still report the missing command cleanly.

Fixes vectorize-io#1681
@benfrank241
Copy link
Copy Markdown
Contributor

@tuancookiez-hub thanks for this. One small nit, could you move import shutil to the top of the file with the other imports?

@nicoloboschi nicoloboschi merged commit 2e5186a into vectorize-io:main May 25, 2026
54 of 55 checks passed
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.

Windows: npx command not found when starting Control Plane UI

3 participants