Symptom
On Windows, every time opencode runs npm (or npx), a Notepad window pops up showing the contents of npm.ps1 instead of (or in addition to) executing the command. Affects both TUI and webchat, since both share the same spawn path.
Environment
- OS: Windows 11
- Node via nvm4w (
C:\nvm4w\nodejs\), npm 11.6.2
- opencode TUI +
opencode web
Root cause (verified on my machine)
- The nvm Node dir ships PowerShell shims next to the
.cmd ones: npm.ps1 + npm.cmd (+ npx.ps1 + npx.cmd).
- opencode (Bun runtime) resolves
npm to npm.ps1 and launches it through the Windows shell open verb.
- The machine-level
.ps1 association is empty (HKCR\.ps1 has no default), and the per-user UserChoice points .ps1 at the Store Notepad (Microsoft.WindowsNotepad_...). So Windows opens the shim source in Notepad.
Workaround
Rename npm.ps1/npx.ps1 to .bak so resolution falls through to npm.cmd/npx.cmd (verified: Get-Command npm -> npm.cmd, both --version work, no Notepad). Reversible.
Suggested fix
On Windows, executable resolution for spawn should prefer .cmd/.exe over .ps1, or invoke .ps1 explicitly via powershell -File. Possibly same family as #17616 (Bun spawn mishandling PowerShell on Windows).
Symptom
On Windows, every time opencode runs
npm(ornpx), a Notepad window pops up showing the contents ofnpm.ps1instead of (or in addition to) executing the command. Affects both TUI and webchat, since both share the same spawn path.Environment
C:\nvm4w\nodejs\), npm 11.6.2opencode webRoot cause (verified on my machine)
.cmdones:npm.ps1+npm.cmd(+npx.ps1+npx.cmd).npmtonpm.ps1and launches it through the Windows shell open verb..ps1association is empty (HKCR\.ps1has no default), and the per-userUserChoicepoints.ps1at the Store Notepad (Microsoft.WindowsNotepad_...). So Windows opens the shim source in Notepad.Workaround
Rename
npm.ps1/npx.ps1to.bakso resolution falls through tonpm.cmd/npx.cmd(verified:Get-Command npm->npm.cmd, both--versionwork, no Notepad). Reversible.Suggested fix
On Windows, executable resolution for spawn should prefer
.cmd/.exeover.ps1, or invoke.ps1explicitly viapowershell -File. Possibly same family as #17616 (Bun spawn mishandling PowerShell on Windows).