错误:没有那个文件(sftpliximomo扩展名)
当我使用liximomo/vscode-sftpVisual Studio 代码的扩展在服务器上上传文件时,我遇到了这个问题。
[error] Error: No such file
at SFTPStream._transform
at SFTPStream.Transform._read
at SFTPStream._read
我该如何解决这个问题?我尝试将文件上传到不同的服务器,所以我想这不是与服务器相关的问题,而是扩展。
回答
GitHub 上有一个更好的修复程序,可以通过 SFTP 扩展上传和下载:
做一个搜索里面
~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js的options.emitClose = false;
options.autoDestroy = false;在两个实例之后添加。- mrjcgoodwin 8 天前评论
-
This link shows where to make the changes
https://github.com/Natizyskunk/ssh2-streams/commit/e1db386ff9b0fc145c67dc13ada3e969d59cc51f#diff-11c2413775403ed66594f387ae0a38ec06ed746902424f86c7cbbbc7e395f4ca
回答
这显然是一个全新的问题,已被引入到较新版本的 VS Code 中。通过修改扩展代码中的一行,我找到了一个似乎运行良好的解决方案。 这仅对 liximomo.sftp 扩展的 1.12.9 版有效。
以下是步骤:
- 关闭/退出 VS Code。
- 找到以下文件:
Mac OS X:
~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.jsWindows:
C:Usersaccount_name.vscodeextensionsliximomo.sftp-1.12.9node_modulesssh2-streamslibsftp.js - 制作文件的备份副本。
- 修改第388行,应该是:
if ( code === STATUS_CODE . OK ) {改成:if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) { - 保存文件。
- 重新启动 VS Code;通过从您的 sftp 服务器上传或下载进行测试。该错误不应该存在。
替代解决方案涉及降级您的 VS Code 版本。这是不可取的,因为您没有获得最新的修复、安全补丁等。
有关此问题,请参阅以下链接:
- https://github.com/liximomo/vscode-sftp/issues/266
- https://github.com/liximomo/vscode-sftp/issues/569(重复)
- https://gitmemory.com/issue/liximomo/vscode-sftp/915/827578565(注意,该站点的 SSL 证书不好)。
如果你想降级你的 VS Code;使用此链接查找旧版本:
https://code.visualstudio.com/updates/v1_55
信用:
宝来自:https : //blog.naver.com/PostView.nhn?blogId = pcgun70&logNo =222341271496
从他们的博客条目(由谷歌翻译成英文):
“一开始没有解决,但是现在,12个小时后,圣者出现了,谁告诉我怎么解决。sftp首先找不到的文件。有一个调用语,VScode升级了,一个错误被调用了,出来了,其实我没有解决问题,即使找不到文件,也导出和成功过程一样的结果,只是修改而已,预计会出修改版将来发布。”
- Actually this add-on has worked fantastic for many months; it was a recent change to the VS Code base that caused the add-on to start misbehave. The only issue is the maintenance of the add-on by the developer .. whom we have not yet heard from. So the community has kicked in and found a solution.