vscoder-server无法离线安装插件

问题:用vscode在远程服务器上离线安装vsix插件时,显示Unable to connect to VS Code server: Error in request.

(py37) [jyh@*]$ code --install-extension workspace/GrapeCity.gc-excelviewer-4.2.59.vsix 
Unable to connect to VS Code server: Error in request.
Error: connect ENOENT /run/user/1013/vscode-ipc-b4d67f3e-a9c0-4052-8e90-abb4a64d2754.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1495:16) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'connect',
  address: '/run/user/1013/vscode-ipc-b4d67f3e-a9c0-4052-8e90-abb4a64d2754.sock'
}

原因:错误消息中的 IPC(Inter-Process Communication)路径可能不再有效。这可能是因为服务器端已关闭或其IPC文件已被移动、删除或因权限问题而无法访问。查看相应目录下的文件,发现确实找不到对应的.sock文件

(py37) [jyh@* ~]$ ls /run/user/1013/ -al
total 0
drwx------  2 jyh  jyh  700 Jul  4 17:09 .
drwxr-xr-x 13 root root 260 Jul  4 10:08 ..
srwxrwxr-x  1 jyh  jyh    0 Jun  5 17:18 vscode-git-31ef15dc93.sock
srwxrwxr-x  1 jyh  jyh    0 May 24 15:45 vscode-git-41df395253.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  6 15:37 vscode-git-8293f9ab17.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 18:18 vscode-git-8704e43eaf.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 18:19 vscode-git-e269e95363.sock
srwxrwxr-x  1 jyh  jyh    0 Jul  4 17:09 vscode-git-ed7a035b1e.sock
srwxrwxr-x  1 jyh  jyh    0 May 27 16:06 vscode-git-f387c9f1a8.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  6 15:37 vscode-ipc-0bc75868-5f6a-44f7-9a8b-18edebc4b7a7.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 17:18 vscode-ipc-0e7fc778-1be6-4b14-a67e-3a25572e7c6d.sock
srwxrwxr-x  1 jyh  jyh    0 Jul  4 17:09 vscode-ipc-19538e97-c57e-4ed3-b1ef-cf696f311db9.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  6 09:34 vscode-ipc-31b55ffa-cc86-4f8f-8527-f63661301d99.sock
srwxrwxr-x  1 jyh  jyh    0 Jul  4 17:09 vscode-ipc-338e7126-c485-45bd-b425-e5be3ab4d619.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  6 09:34 vscode-ipc-3879888a-68b3-4af7-8808-0c889e86aad9.sock
srwxrwxr-x  1 jyh  jyh    0 May 24 15:48 vscode-ipc-44764de9-a64b-4fb0-9d91-c9c159a4f508.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 17:16 vscode-ipc-44c39a75-c04f-4c03-a912-cf14a1b9855c.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 18:19 vscode-ipc-58d0d996-f0fa-4344-bc3e-7184402975d9.sock
srwxrwxr-x  1 jyh  jyh    0 Jul  2 11:17 vscode-ipc-5d7cb2bd-9fc5-47d4-a45f-9e9957f6e847.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 18:19 vscode-ipc-607e2bc9-00c5-4ec8-ae97-4abd3097bd7e.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 18:19 vscode-ipc-6a9c8e03-b961-4ad7-9608-ea372a5f1d07.sock
srwxrwxr-x  1 jyh  jyh    0 Jun 17 19:59 vscode-ipc-738e08bc-f26a-46a6-b5f4-769aa0685912.sock
srwxrwxr-x  1 jyh  jyh    0 Jul  4 16:38 vscode-ipc-7e563e04-ee89-4851-b823-1f761f265678.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 18:19 vscode-ipc-7e60cf3a-7de9-416d-86a0-d88e8e0ecff6.sock
srwxrwxr-x  1 jyh  jyh    0 Jul  4 17:03 vscode-ipc-a77363f7-59c6-428a-94be-d28393a72488.sock
srwxrwxr-x  1 jyh  jyh    0 Jun 18 14:12 vscode-ipc-ae7202a7-7d38-40e2-a5b5-03d8a7ece18b.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 18:18 vscode-ipc-b4191ada-5c53-4062-95bc-bb4f218c3d42.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  6 09:34 vscode-ipc-b95b95ad-7742-4b06-bae9-42a2e6e6128d.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 17:17 vscode-ipc-ba3de14a-9fea-4e5a-9b4b-3666feb516b5.sock
srwxrwxr-x  1 jyh  jyh    0 May 27 16:06 vscode-ipc-c8dcf148-650b-44ad-b9ea-64a6d0711355.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 18:10 vscode-ipc-d619684a-6d1c-4a79-9aa9-15f51adcbb0c.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  5 18:19 vscode-ipc-d61eae2c-a1f9-4536-9fa1-2b2e4a0bdb7c.sock
srwxrwxr-x  1 jyh  jyh    0 Jun 11 15:11 vscode-ipc-da7137fd-e61d-4c13-9f9f-753d43ba532a.sock
srwxrwxr-x  1 jyh  jyh    0 May 24 15:45 vscode-ipc-e60f3841-f875-4a8d-938e-bf5e12ddc8a2.sock
srwxrwxr-x  1 jyh  jyh    0 Jun  7 18:32 vscode-ipc-edbe2919-3fd6-4cf4-835c-37c8013d6891.sock

解决办法:将环境变量VSCODE_IPC_HOOK_CLI设为任意存在的.sock文件路径。再通过命令行安装插件即可。

(py37) [jyh@* ~]$ VSCODE_IPC_HOOK_CLI=/run/user/1013/vscode-ipc-19538e97-c57e-4ed3-b1ef-cf696f311db9.
sock
(py37) [jyh@* ~]$ code --install-extension GrapeCity.gc-excelviewer-4.2.59.vsix 
Installing extensions on SSH: 192.1.64.45...
Extension 'GrapeCity.gc-excelviewer-4.2.59.vsix' was successfully installed.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值