Skip to content

Fix: run npm via shell in start_app.py so it works on Windows#225

Open
noramxiao wants to merge 2 commits into
mainfrom
fix/windows-start-app-shell
Open

Fix: run npm via shell in start_app.py so it works on Windows#225
noramxiao wants to merge 2 commits into
mainfrom
fix/windows-start-app-shell

Conversation

@noramxiao
Copy link
Copy Markdown
Contributor

@noramxiao noramxiao commented May 29, 2026

Problem

On Windows, uv run start-app fails with FileNotFoundError during frontend setup. start_app.py runs the npm commands as:

subprocess.run(cmd.split(), cwd=frontend_dir, capture_output=True, text=True)

npm on Windows is a .cmd shim that CreateProcess can't execute directly, so passing a split argv (["npm", "install"]) raises FileNotFoundError. Reported in #126.

Change

subprocess.run(cmd, cwd=frontend_dir, capture_output=True, text=True, shell=True)

Passing the command string with shell=True resolves the executable through the platform shell on Windows (cmd.exe), macOS, and Linux (/bin/sh -c), so the same code works everywhere. This matches the fix suggested by the reporter.

Testing

Linux regression check

Ran the exact post-change invocation against the real e2e-chatbot-app-next frontend on Linux (node v24, npm 11.9):

subprocess.run("npm install", cwd=frontend_dir, capture_output=True, text=True, shell=True)   # rc=0
subprocess.run("npm run build", cwd=frontend_dir, capture_output=True, text=True, shell=True)  # rc=0, build complete

Both succeed, so shell=True with the string command is non-regressive on Linux. macOS uses the same /bin/sh -c path, so it's covered by the same mechanism.

Windows (the platform the fix targets) still needs a manual uv run start-app check — the .cmd shim / CreateProcess failure can't be reproduced off Windows.

Fixes #126

noramxiao added 2 commits May 29, 2026 17:23
start_app.py invoked `subprocess.run(cmd.split(), ...)` for `npm install` and
`npm run build`. On Windows npm is a `.cmd` shim that CreateProcess cannot
execute directly, so a split argv raised FileNotFoundError. Pass the command
string with shell=True so it resolves through the platform shell on Windows,
macOS, and Linux.

Edited the synced source (.scripts/source/start_app.py) and propagated to all
templates via `python .scripts/sync-scripts.py`.

Fixes #126

Co-authored-by: Isaac
@noramxiao noramxiao requested a review from annzhang-db June 1, 2026 15:41
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.

Issue in start_app.py when running on Windows

1 participant