vscode "posix_spawn: No such file or directory"

476 阅读1分钟

场景:window ---> linux ----> linux 出错:failed to parse remote port from server output

Solution 0: 解决方案零:

对于遇到同样问题的任何人,我通过给出 ssh 的绝对位置来解决它,例如:

ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p server

Solution 1: 解决方案一:

根据此错误,修复方法是使用完整路径。所以这是 .ssh/config 中的正确行:

  ProxyCommand  C:\Windows\System32\OpenSSH\ssh.exe jumphost netcat -w 120 %h %p

如需进一步开发,请参阅此问题:github.com/microsoft/v…

Solution 2: 解决方案2:

TL;DR 长话短说

ProxyCommand 应调用带有 .exe 扩展名的 ssh,例如:

ProxyCommand ssh.exe -q -W %h:%p yyy

The long(?) story 很长的(?)故事

 运行 ssh -vvv XXX 显示:

debug3: spawning "C:\Windows\System32\OpenSSH\ssh -q -W XXX:22 YYY"
CreateProcessW failed error:2
posix_spawn: No such file or directory

根据 MSDN 上的 CreateProcess 文档,我猜 posix_spawn 正在以 lpApplicationName 参数必须是精确且绝对路径的方式调用 CreateProcess 。指定 .exe 后缀后,似乎就修复了。


Solution 3: 解决方案3:

我遇到了同样的错误,但这是因为 DISPLAY 环境变量设置为某个值。一旦取消设置该环境变量,错误就会消失。