VSCode + MobaXterm Remote配置以及connect error:The process tried to write to a nonexistent pipe解决办法

本文介绍了如何配置VSCode与MobaXterm进行远程开发,包括安装Remote Development插件,设置远程服务器信息,并详细说明了解决'process tried to write to a nonexistent pipe'错误的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

VSCode + MobaXterm Remote配置

我们在本地桌面上使用VSCode远程连接服务器上的文件夹,进行日常开发工作,需以下流程:

  1. VSCode 安装插件Remote Development;

!

  1. 点击远程资源管理器,点击“+”号,打开config文件,Host为远程服务器名称(可自由定义),Host Name填写远程服务器的IP地址,User填写登录远程服务器的用户名;

在这里插入图片描述
3. 把鼠标放在SSH TARGETS下出现的Host名称上,右键,选择在当前窗口或新窗口连接远程服务器,按照提示输入密码即可连接。

在这里插入图片描述

The process tried to write to a nonexistent pipe问题的解决

在使用过程中,偶尔会出现电脑熄屏或者网络断开后再连接时,远程连接失败报错的情况,
报错信息

[13:24:06.734] Log Level: 2 [13:24:06.748] SSH Resolver called for "ssh-remote+root", attempt 1 [13:24:06.752] remote.SSH.useLocalServer = false [13:24:06.752] remote.SSH.useExecServer = true [13:24:06.752] remote.SSH.bindHost = {} [13:24:06.752] remote.SSH.showLoginTerminal = false [13:24:06.752] remote.SSH.remotePlatform = {} [13:24:06.754] remote.SSH.path = [13:24:06.754] remote.SSH.configFile = [13:24:06.754] remote.SSH.useFlock = true [13:24:06.754] remote.SSH.lockfilesInTmp = false [13:24:06.754] remote.SSH.localServerDownload = auto [13:24:06.754] remote.SSH.remoteServerListenOnSocket = false [13:24:06.754] remote.SSH.defaultExtensions = [] [13:24:06.754] remote.SSH.defaultExtensionsIfInstalledLocally = [] [13:24:06.754] remote.SSH.loglevel = 2 [13:24:06.755] remote.SSH.enableDynamicForwarding = true [13:24:06.755] remote.SSH.enableRemoteCommand = false [13:24:06.755] remote.SSH.serverPickPortsFromRange = {} [13:24:06.755] remote.SSH.serverInstallPath = {} [13:24:06.755] remote.SSH.permitPtyAllocation = false [13:24:06.755] remote.SSH.preferredLocalPortRange = undefined [13:24:06.755] remote.SSH.useCurlAndWgetConfigurationFiles = false [13:24:06.755] remote.SSH.experimental.chat = true [13:24:06.755] remote.SSH.experimental.enhancedSessionLogs = true [13:24:06.756] remote.SSH.httpProxy = {"*":""} [13:24:06.756] remote.SSH.httpsProxy = {"*":""} [13:24:06.763] VS Code version: 1.101.1 [13:24:06.763] Remote-SSH version: remote-ssh@0.120.0 [13:24:06.763] win32 x64 [13:24:06.765] SSH Resolver called for host: root [13:24:06.765] Setting up SSH remote "root" [13:24:06.771] Using commit id "18e3a1ec544e6907be1e944a94c496e302073435" and quality "stable" for server [13:24:06.771] Extensions to install: [13:24:06.777] Install and start server if needed [13:24:09.050] Checking ssh with "C:\Program Files (x86)\Common Files\Oracle\Java\java8path\ssh.exe -V" [13:24:09.051] Got error from ssh: spawn C:\Program Files (x86)\Common Files\Oracle\Java\java8path\ssh.exe ENOENT [13:24:09.051] Checking ssh with "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe -V" [13:24:09.052] Got error from ssh: spawn C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe ENOENT [13:24:09.052] Checking ssh with "C:\Windows\system32\ssh.exe -V" [13:24:09.053] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT [13:24:09.053] Checking ssh with "C:\Windows\ssh.exe -V" [13:24:09.053] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT [13:24:09.054] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V" [13:24:09.054] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT [13:24:09.054] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V" [13:24:09.055] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT [13:24:09.055] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V" [13:24:09.073] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2 [13:24:09.077] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 54688 root sh [13:24:09.077] Generated SSH command: 'type "C:\Users\chen\AppData\Local\Temp\vscode-linux-multi-line-command-root-306797396.sh" | "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 54688 root sh' [13:24:09.078] Using connect timeout of 17 seconds [13:24:09.078] Terminal shell path: C:\Windows\System32\cmd.exe [13:24:09.325] > C:\\Users\\chen/.ssh/config line 3: keyword hostname extra arguments at end of line > C:\\Users\\chen/.ssh/config line 4: keyword user extra arguments at end of line > C:\\Users\\chen/.ssh/config line 5: Bad port '22#'. > C:\\Users\\chen/.ssh/config: terminating, 3 bad configuration options > 过程试图写入的管道不存在。 [13:24:09.325] Got some output, clearing connection timeout [13:24:10.570] "install" terminal command done [13:24:10.570] Install terminal quit with output: 过程试图写入的管道不存在。 [13:24:10.571] Received install output: 过程试图写入的管道不存在。 [13:24:10.571] WARN: $PLATFORM is undefined in installation script output. Errors may be dropped. [13:24:10.571] Failed to parse remote port from server output [13:24:10.571] Resolver error: Error at y.Create (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:744751) at t.handleInstallOutput (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:742832) at t.tryInstall (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:865534) at async c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:824246 at async t.withShowDetailsEvent (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:827501) at async A (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:820760) at async t.resolve (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:824898) at async c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:1113660 [13:24:10.576] ------ [13:24:10.578] No hints found in the recent session. [13:24:11.043] Opening exec server for ssh-remote+root [13:24:11.056] Initizing new exec server for ssh-remote+root [13:24:11.056] Using commit id "18e3a1ec544e6907be1e944a94c496e302073435" and quality "stable" for server [13:24:11.056] Extensions to install: [13:24:11.122] Opening exec server for ssh-remote+root [13:24:11.125] Install and start server if needed [13:24:13.130] getPlatformForHost was canceled [13:24:13.130] Exec server for ssh-remote+root failed: Error: 已取消连接 [13:24:13.130] Existing exec server for ssh-remote+root errored (Error: 已取消连接) [13:24:13.130] Initizing new exec server for ssh-remote+root [13:24:13.130] Error opening exec server for ssh-remote+root: Error: 已取消连接 [13:24:13.131] No hints found in the recent session. [13:24:13.131] Using commit id "18e3a1ec544e6907be1e944a94c496e302073435" and quality "stable" for server [13:24:13.131] Extensions to install: [13:24:13.133] Install and start server if needed
最新发布
06-22
### 配置 MobaXtermVSCode 进行远程开发 #### 安装必要工具和扩展 为了实现VSCodeMobaXterm之间的协作,确保已安装必要的软件组件: - **VSCode**: 下载并安装最新版本的Visual Studio Code编辑器。 - **Remote Development 扩展包**:在VSCode内安装由微软官方提供的Remote Development扩展集合[^2]。 #### 设置 SSH 密钥认证 建立安全可靠的SSH连接对于远程开发至关重要。如果尚未设置无密码登录,则需要生成一对SSH密钥,并将其公钥复制到目标Linux服务器上。 ```bash ssh-keygen -t rsa -b 4096 -C "your_email@example.com" ssh-copy-id user@remote_host ``` #### 创建自定义会话配置文件 启动MobaXterm,在其界面中新建一个Session用于保存特定主机的信息。选择合适的协议(通常是SSH),输入相应的IP地址/域名及端口号等参数完成基本设定。还可以进一步调整终端仿真方式、字体大小等方面来优化用户体验。 #### 使用 VSCodeRemote-SSH 功能 打开命令面板 (`Ctrl+Shift+P`) 并执行 `Remote-SSH: Connect to Host` 命令,按照提示输入之前创建好的SSH连接字符串(例如:`user@remote_host`)。首次访问时可能需要确认指纹验证以及下载额外的支持程序。 一旦成功建立了链接之后就可以像操作本地项目一样浏览远端目录结构了;右键单击想要同步过来的工作区或文件夹即可开启新的窗口实例来进行编码作业。 #### 解决常见问题 当遇到“The process tried to write to a nonexistent pipe”的错误消息时,通常是因为SSH隧道未正常关闭所引起的残留进程干扰所致。尝试重启服务端sshd守护线程或是清理客户端缓存数据后再重试一次连接动作应该可以解决问题。 另外值得注意的是,在实际编程过程中可能会碰到由于缺少依赖库而导致的各种异常状况——比如Python环境下找不到某些第三方模块的情况。此时建议预先构建独立于默认系统的conda/virtualenv环境以便更好地管理各个项目的专属需求[^3]。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值