Skip to content

fix(core): prefer Windows .cmd over nvm .ps1 shims when spawning npm/npx - #50050

Open
cestercian wants to merge 1 commit into
anomalyco:devfrom
cestercian:cursor/windows-npm-spawn-8e25
Open

cestercian wants to merge 1 commit into
anomalyco:devfrom
cestercian:cursor/windows-npm-spawn-8e25

Conversation

@cestercian

Copy link
Copy Markdown

Issue for this PR

Fixes #50040

Type of change

  • Bug fix

What does this PR do?

On Windows, nvm ships npm.ps1 / npx.ps1 next to .cmd. Bun can resolve the .ps1 and ShellExecute it as a document (Notepad). Drop .PS1 from PATHEXT for resolution and rewrite spawn targets to a sibling .cmd / .exe / .bat in the shared spawn paths (TUI + webchat + MCP stdio npx).

How did you verify your code works?

  • packages/core/test/util/which.test.ts
  • packages/opencode/test/util/process.test.ts (Windows spawn cases skipped on Linux)
  • bun typecheck in packages/core and packages/opencode

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Windows nvm ships npm.ps1 next to npm.cmd. Resolving the PowerShell shim
lets ShellExecute open it in Notepad. Drop .PS1 from PATHEXT and rewrite
spawn targets to a sibling .cmd/.exe/.bat.

Fixes anomalyco#50040
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

This branch has not been deployed

No deployments
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] Spawning npm/npx opens npm.ps1 in Notepad instead of executing (nvm .ps1 shims)

2 participants