liximomo / vscode-sftp

Super fast sftp/ftp extension for VS Code
MIT License
1.5k stars 256 forks source link

cannot upload file to server. no such file or directory, open 'C:\Users\MyPC\.ssh\config' #936

Open vccvn opened 3 years ago

vccvn commented 3 years ago

i try to reset my compute. but nothing change. message:

[05-14 17:46:22] [warn] ENOENT: no such file or directory, open 'C:\Users\MyPC.ssh\config' load C:\Users\MyPC.ssh\config failed [05-14 17:46:23] [warn] Can't set modified time to the file because Failure [05-14 17:46:23] [error] Error: No such file at SFTPStream._transform (c:\Users\MyPC.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js:412:27) at SFTPStream.Transform._read (internal/streams/transform.js:205:10) at SFTPStream._read (c:\Users\MyPC.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js:183:15) at SFTPStream.Transform._write (internal/streams/transform.js:193:12) at writeOrBuffer (internal/streams/writable.js:358:12) at SFTPStream.Writable.write (internal/streams/writable.js:303:10) at Channel.ondata (internal/streams/readable.js:719:22) at Channel.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Channel.Readable.push (internal/streams/readable.js:223:10) at SSH2Stream. (c:\Users\MyPC.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2\lib\Channel.js:167:15) at SSH2Stream.emit (events.js:315:20) at parsePacket (c:\Users\MyPC.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\ssh.js:3288:10) at SSH2Stream._transform (c:\Users\MyPC.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\ssh.js:694:13) at SSH2Stream.Transform._read (internal/streams/transform.js:205:10) at SSH2Stream._read (c:\Users\MyPC.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\ssh.js:253:15) at SSH2Stream.Transform._write (internal/streams/transform.js:193:12) at writeOrBuffer (internal/streams/writable.js:358:12) at SSH2Stream.Writable.write (internal/streams/writable.js:303:10) at Socket.ondata (internal/streams/readable.js:719:22) at Socket.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Socket.Readable.push (internal/streams/readable.js:223:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) when local āžž remote e:\threejs\index.html

whiteSpaceX commented 3 years ago

Same problem here on multiple computers. It's because of the VS update.

whiteSpaceX commented 3 years ago

Temporary fix:

Here are the steps:

Shutdown / Quit VS Code. 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

Make a backup copy of the file. 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) {

Save the file.

Relaunch VS Code; test by uploading or downloading from your sftp server. The error should not be present.

iliailmer commented 3 years ago

I get the "No such file" error on every file, but it still uploads, I can see changes via SSH. is there a way to disable the error message for extension?

maartenvandillen commented 3 years ago

@iliailmer be aware that it looks like it's uploading but I get some random empty (0 bytes) files on the server.

JimNayzium commented 3 years ago

I have searched for this uploadOnSave problem and found many different iterations of it. Mine is solved only by opening the sftp.json file and hitting a space bar once to alter that file. Save it. Then immediately switch to my altered regular file that I want uploaded on the save and hitting space bar once randomly somewhere then saving and it uploads properly on that save.

But if I then edit the regular file again in anyway and hit save. It won't upload until I switch over to the sftp.json file and alter it again, then return to the regular file and now alter it again and hit save!

The error I am getting in the debug is

[warn] ENOENT: no such file or directory, open '/Users/my_username_here/.ssh/config' load /Users/my_username_here/.ssh/config failed

So it seems like my .ssh folder maybe is messed up somehow? I thought maybe it wouldn't work while I was running XAMPP at the same time but I have since closed XAMPP and rebooted computer.

When I inspect my .ssh folder in my user folder I indeed do NOT have a config file there, and cannot find any information I trust on what to do next. This problem seems common among WINDOWS users but those solutions don't track with the Mac folder structures etc... I am on a mac.

My problem maybe very simple if someone could kindly help me understand what to add to the .ssh folder in my user folder? And maybe even suggest what I did that caused the .ssh folder to rid itself of the config file? I didn't do that on purpose obviously hahaha.

THANKS!

Natizyskunk commented 2 years ago

You can try my version, i've fixed a lot of bugs, maybe this will fix yours šŸ™‚ https://github.com/Natizyskunk/vscode-sftp/releases