Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: No such file (sftp liximomo extension)

I have this problem when I upload a file on the server using the extension liximomo/vscode-sftp for visual studio code.

[error] Error: No such file
    at SFTPStream._transform
    at SFTPStream.Transform._read
    at SFTPStream._read
    

How I can fix this problem? I tried to upload files to different servers, so I guess it's not a server-related problem but an extension.

like image 748
Michele Cerruto Avatar asked May 12 '21 15:05

Michele Cerruto


4 Answers

There is a better fix on GitHub that works for upload and download via SFTP extension:

Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;

Add options.autoDestroy = false; after both instances.

- mrjcgoodwin commented 8 days ago

like image 161
JcG Avatar answered Oct 19 '22 03:10

JcG


This is apparently a brand new problem that has been introduced into the newer versions of VS Code. I have FOUND A SOLUTION that seems to work well, by modifying a single line in the extension code. This is only valid for version 1.12.9 of the liximomo.sftp extension.

Here are the steps:

  1. Shutdown / Quit VS Code.
  2. Locate the following file:
    Mac OS X:
    ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js

    Windows:
    C:\Users\account_name\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js
  3. Make a backup copy of the file.
  4. Modify line 388, which should be:
    if ( code === STATUS_CODE . OK ) { changing it to:
    if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) {
  5. Save the file.
  6. Relaunch VS Code; test by uploading or downloading from your sftp server. The error should not be present.

The alternative solution involves downgrading your version of VS Code. This is not desirable as you are not getting the latest fixes, security patches, etc..

See the following links regarding this issue:

  • https://github.com/liximomo/vscode-sftp/issues/266
  • https://github.com/liximomo/vscode-sftp/issues/569 (repeat)
  • https://gitmemory.com/issue/liximomo/vscode-sftp/915/827578565 (note, this site has a bad SSL certificate).

If you want to downgrade your VS Code; use this link to find the older versions:

https://code.visualstudio.com/updates/v1_55


CREDIT:
Bao from: https://blog.naver.com/PostView.nhn?blogId=pcgun70&logNo=222341271496
From their blog entry (translated by Google to English):

"At first, there was no solution, but Now, 12 hours later, the Holy One appeared, who told me how to solve it.files that sftp cannot find in the first place. There is a calling phrase, VScode is upgraded and an error is called. It came out. Actually, I did not solve the problem. Even if the file is not found, the same result as the success process is exported. It is just a modification. It is expected that a modified version will be released in the future."

like image 42
jewettg Avatar answered Oct 19 '22 03:10

jewettg


Not an answer to the problem, but solution in another (simple) way:

  1. install Run On Save VSCode extension

  2. write a deploy.sh script along the lines

    rsync -avz -e 'ssh -i /home/user/.ssh/id_rsa' --exclude '.history' --exclude '.vscode' --exclude '.git' --exclude '.gitignore' --exclude 'deploy.sh' ./ [email protected]:/home/user/public_html/
    
  3. add the following configuration to VSCode settings.json to trigger the deploy.sh script on file save:

    "emeraldwalk.runonsave": {
         "commands": [
             {
                 "match": ".*",
                 "isAsync": false,
                 "cmd": "${workspaceFolder}/deploy.sh"
             },            
         ]
     }
    
like image 1
steakoverflow Avatar answered Oct 19 '22 03:10

steakoverflow


Just switch to the second one:

enter image description here

like image 1
黄心雨 Avatar answered Oct 19 '22 02:10

黄心雨