Repository navigation
[Bug] pwsh spawn ENOENT on Windows when PowerShell is installed via Microsoft Store (stale WindowsApps path after Store update) #1676
Replies: 2 comments
|
That's not the cause. The reparse point works correctly, but it doesn't get resolved, because This longstanding bug mostly affects child processes of A workaround can be tested via adding this to profile or otherwise executing before spawning children… $env:PATH = ($env:PATH -split ';' | Select-Object -Skip 1) -join ';'See here: PowerShell/PowerShell#10894 (comment) |
|
这个补充评论说明了为什么不能把 system-level WindowsApps 路径一概判定为“不可 spawn”:需要同时记录 Harness 是由 pwsh 还是 cmd 启动、子进程继承的 PATH,以及实际 CreateProcess 的 candidate。把显式 pwshPath 作为 workaround 也应标成诊断/临时绕过,而不是根因结论。 我维护的独立 DeepSeek Harness 社区手册 Windows compatibility guide 建议用同一 profile 做四路对照:
每一路都应区分 lstat/resolve 成功、CreateProcess 成功、工具执行成功三层证据; |
Uh oh!
There was an error while loading. Please reload this page.
Symptom
On Windows 11, every pwsh tool call fails with:
All shell execution (pwsh tool, cmd, everything routed through the shell executor) fails. This happens when PowerShell 7 is installed ONLY via Microsoft Store (no standard install at
C:\Program Files\PowerShell\7\pwsh.exe).Root cause
@deepseek-ai/dsh-pwsh-localresolves the pwsh path by probing candidates (seelib/index.jscandidatePwshPaths/candidateExists):C:\Program Files\PowerShell\7\pwsh.exe(standard install) — MISSING on this machinepwsh.exe— picks up the Store execution alias directory underC:\Program Files\WindowsApps\...candidateExistsuseslstatSync, which reports the Store app execution alias as "exists" (it's a reparse point). But spawning the system-levelC:\Program Files\WindowsApps\...\pwsh.exepath directly fails with ENOENT — it's a protected path that must be reached through the user-level alias%LOCALAPPDATA%\Microsoft\WindowsApps\pwsh.exe.In my case the Store app updated from 7.6.4 → 7.6.5, which made the stale
Microsoft.PowerShell_7.6.4.0_x64__...path disappear entirely — dsh still resolved to it (cached or via stale PATH), hence ENOENT.Verified test matrix (Node spawnSync)
C:\Program Files\PowerShell\7\pwsh.exe%LOCALAPPDATA%\Microsoft\WindowsApps\pwsh.exeC:\Program Files\WindowsApps\Microsoft.PowerShell_7.6.4.0_x64__...\pwsh.exeC:\Windows\System32\WindowsPowerShell\v1.0\powershell.exeWorkaround (verified, hot-reload, no restart)
Add to
~/.dsh/settings.yaml:The
shellsettings namespace is hot-reloaded; pwsh tool works immediately after.Suggested fix
candidateExistsshould validate that a candidate is actually spawnable, not just lstat-visible (Store execution aliases pass lstat but fail CreateProcess for the system-level WindowsApps path).%LOCALAPPDATA%\Microsoft\WindowsApps\pwsh.exeover the system-levelC:\Program Files\WindowsApps\...path when both exist.C:\Program Files\WindowsApps\...candidates entirely and rely on PATH resolution of the user-level alias.Related
undefined.preparecrash). This is an independent issue: pwsh executable resolution on Store-installed PowerShell.Environment: Windows 11 24H2, dsh 0.1.0-rc.6, PowerShell 7.6.5 (Store).
All reactions