Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Can't create directory: File exists when remotepath is "/" #146

Closed
bliteknight opened this issue Mar 23, 2018 · 12 comments
Closed

Error: Can't create directory: File exists when remotepath is "/" #146

bliteknight opened this issue Mar 23, 2018 · 12 comments

Comments

@bliteknight
Copy link

Expected Behavior

File should be uploaded to the remote location

Actual Behavior

Throws an error: Error: Can't create directory: File exists

Steps to Reproduce the Problem

  1. Create a chrooted account for the ftp user so it's "/" = "/usr/test/" (e.g)
  2. Setup sft.json to connect to ftp server using the account.
  3. Create and save a file in the root directory and try to up load it.

Requisites (important to diagnose the problem!)

Extension Logs

[info] connected
[error]: Error: Can't create directory: File exists
at makeError (C:\Users\bliteknight.vscode\extensions\liximomo.sftp-1.1.5\node_modules\ftp\lib\connection.js:1077:13)
at Parser. (C:\Users\bliteknight.vscode\extensions\liximomo.sftp-1.1.5\node_modules\ftp\lib\connection.js:116:25)
at emitTwo (events.js:106:13)
at Parser.emit (events.js:194:7)
at Parser._write (C:\Users\bliteknight.vscode\extensions\liximomo.sftp-1.1.5\node_modules\ftp\lib\parser.js:59:10)
at doWrite (_stream_writable.js:329:12)
at writeOrBuffer (_stream_writable.js:315:5)
at Parser.Writable.write (_stream_writable.js:241:11)
at Socket.ondata (C:\Users\bliteknight.vscode\extensions\liximomo.sftp-1.1.5\node_modules\ftp\lib\connection.js:277:20)
at emitOne (events.js:96:13)

Specifications

  • Version: 1.1.5
  • Platform: Windows 10
@liximomo
Copy link
Owner

I need the full log.

@bliteknight
Copy link
Author

Here it is, looks like it's trying to create "/" folder

[debug] < 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------\r\n220-You are user number 4 of 50 allowed.\r\n220-Local time is now 10:56. Server port: 21.\r\n220-This is a private system - No anonymous login\r\n220-IPv6 connections are also welcome on this server.\r\n220 You will be disconnected after 15 minutes of inactivity.
[debug] > USER ******
[debug] < 331 User ******* OK. Password required
[debug] > PASS ******
[debug] < 230 OK. Current restricted directory is /
[debug] > FEAT
[debug] < 211-Extensions supported:\r\n EPRT\r\n IDLE\r\n MDTM\r\n SIZE\r\n MFMT\r\n REST STREAM\r\n MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;\r\n MLSD\r\n AUTH TLS\r\n PBSZ\r\n PROT\r\n UTF8\r\n TVFS\r\n ESTA\r\n PASV\r\n EPSV\r\n SPSV\r\n ESTP\r\n211 End.
[debug] > TYPE I
[debug] < 200 TYPE is now 8-bit binary
[info] connected
[debug] > PASV
[debug] < 227 Entering Passive Mode (199,188,200,94,47,48)
[debug] > LIST /
[debug] < 150 Accepted data connection
[debug] < 226-Options: -a -l \r\n226 16 matches total
[debug] > MKD /
[debug] < 550 Can't create directory: File exists
[error]: Error: Can't create directory: File exists
at makeError (C:\Users\bliteknight.vscode\extensions\liximomo.sftp-1.1.5\node_modules\ftp\lib\connection.js:1077:13)
at Parser. (C:\Users\bliteknight.vscode\extensions\liximomo.sftp-1.1.5\node_modules\ftp\lib\connection.js:116:25)
at emitTwo (events.js:106:13)
at Parser.emit (events.js:194:7)
at Parser._write (C:\Users\bliteknight.vscode\extensions\liximomo.sftp-1.1.5\node_modules\ftp\lib\parser.js:59:10)
at doWrite (_stream_writable.js:329:12)
at writeOrBuffer (_stream_writable.js:315:5)
at Parser.Writable.write (_stream_writable.js:241:11)
at Socket.ondata (C:\Users\bliteknight.vscode\extensions\liximomo.sftp-1.1.5\node_modules\ftp\lib\connection.js:277:20)
at emitOne (events.js:96:13)
[debug] < 200 Zzz...

@liximomo
Copy link
Owner

I've known the problem. Please wait for the fix.

@bliteknight
Copy link
Author

Awesome, let me know if I can help in any way.

@liximomo
Copy link
Owner

@bliteknight I've made a fix-package . Please help me test it.

@bliteknight
Copy link
Author

Just installed it and it works. Thanks for the fix.

[debug] < 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------\r\n220-You are user number 5 of 50 allowed.\r\n220-Local time is now 07:25. Server port: 21.\r\n220-This is a private system - No anonymous login\r\n220-IPv6 connections are also welcome on this server.\r\n220 You will be disconnected after 15 minutes of inactivity.
[debug] > USER ******
[debug] < 331 User ****** OK. Password required
[debug] > PASS ******
[debug] < 230 OK. Current restricted directory is /
[debug] > FEAT
[debug] < 211-Extensions supported:\r\n EPRT\r\n IDLE\r\n MDTM\r\n SIZE\r\n MFMT\r\n REST STREAM\r\n MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;\r\n MLSD\r\n AUTH TLS\r\n PBSZ\r\n PROT\r\n UTF8\r\n TVFS\r\n ESTA\r\n PASV\r\n EPSV\r\n SPSV\r\n ESTP\r\n211 End.
[debug] > TYPE I
[debug] < 200 TYPE is now 8-bit binary
[info] connected
[debug] > PASV
[debug] < 227 Entering Passive Mode (199,188,200,94,47,83)
[debug] > LIST /
[debug] < 150 Accepted data connection
[debug] < 226-Options: -a -l \r\n226 17 matches total
[debug] > PASV
[debug] < 227 Entering Passive Mode (199,188,200,94,47,33)
[debug] > STOR /index.html
[debug] < 150 Accepted data connection
[debug] < 226-File successfully transferred\r\n226 0.220 seconds (measured here), 136.65 Kbytes per second
[info] [file-save] upload e:\Projects**-www\index.html

@alireainc
Copy link

alireainc commented Mar 27, 2018

I think the fix to this issue has created another issue. My remotePath is set to "/" because my ftp points to the root of my test site directory. Anything that attempts to gets published to the root receives the following error: "[sftp] Directoryname not valid". Anything that publishes to a subfolder in the root publishes fine.

@liximomo
Copy link
Owner

@alireainc Can you create a new issue with detail info?

@lucasbordeau
Copy link

Same problem here, I removed and reinstalled the package 2 days ago, nothing changes, and if I get this error no files at all are uploaded.

My setup is exactly the same as @alireainc

I get this error every time I try to upload now :

[sftp] Directoryname not valid

Here is the FTP server log (FileZilla on a Windows Server) :

(000067)4/2/2018 12:21:45 PM - dev (XX.XX.XX.XX)> PASV
(000067)4/2/2018 12:21:45 PM - dev (XX.XX.XX.XX)> 227 Entering Passive Mode (XX.XX.XX.XX.XX)
(000067)4/2/2018 12:21:45 PM - dev (XX.XX.XX.XX)> LIST /
(000067)4/2/2018 12:21:45 PM - dev (XX.XX.XX.XX)> 150 Opening data channel for directory listing of "/"
(000067)4/2/2018 12:21:45 PM - dev (XX.XX.XX.XX)> 226 Successfully transferred "/"
(000067)4/2/2018 12:21:45 PM - dev (XX.XX.XX.XX)> MKD /
(000067)4/2/2018 12:21:45 PM - dev (XX.XX.XX.XX)> 550 Directoryname not valid

@pi-vincent
Copy link

pi-vincent commented May 3, 2018

Same issue when auto uploading from root...

[error]: Error: Can't create directory: File exists
	at makeError (C:\Users\Vince\.vscode\extensions\liximomo.sftp-1.1.7\node_modules\ftp\lib\connection.js:1067:13)
	at Parser.<anonymous> (C:\Users\Vince\.vscode\extensions\liximomo.sftp-1.1.7\node_modules\ftp\lib\connection.js:113:25)
	at emitTwo (events.js:106:13)
	at Parser.emit (events.js:194:7)
	at Parser._write (C:\Users\Vince\.vscode\extensions\liximomo.sftp-1.1.7\node_modules\ftp\lib\parser.js:59:10)
	at doWrite (_stream_writable.js:329:12)
	at writeOrBuffer (_stream_writable.js:315:5)
	at Parser.Writable.write (_stream_writable.js:241:11)
	at Socket.ondata (C:\Users\Vince\.vscode\extensions\liximomo.sftp-1.1.7\node_modules\ftp\lib\connection.js:273:20)
	at emitOne (events.js:96:13)
	at Socket.emit (events.js:191:7)
	at readableAddChunk (_stream_readable.js:178:18)
	at Socket.Readable.push (_stream_readable.js:136:10)
	at TCP.onread (net.js:560:20)
[info] upload D:\PATH_TO_CONTENT\myfile.php
[error]: Error: Can't create directory: File exists
	at makeError (C:\Users\Vince\.vscode\extensions\liximomo.sftp-1.1.7\node_modules\ftp\lib\connection.js:1067:13)
	at Parser.<anonymous> (C:\Users\Vince\.vscode\extensions\liximomo.sftp-1.1.7\node_modules\ftp\lib\connection.js:113:25)
	at emitTwo (events.js:106:13)
	at Parser.emit (events.js:194:7)
	at Parser._write (C:\Users\Vince\.vscode\extensions\liximomo.sftp-1.1.7\node_modules\ftp\lib\parser.js:59:10)
	at doWrite (_stream_writable.js:329:12)
	at writeOrBuffer (_stream_writable.js:315:5)
	at Parser.Writable.write (_stream_writable.js:241:11)
	at Socket.ondata (C:\Users\Vince\.vscode\extensions\liximomo.sftp-1.1.7\node_modules\ftp\lib\connection.js:273:20)
	at emitOne (events.js:96:13)
	at Socket.emit (events.js:191:7)
	at readableAddChunk (_stream_readable.js:178:18)
	at Socket.Readable.push (_stream_readable.js:136:10)
	at TCP.onread (net.js:560:20)
[info] [file-save] upload D:\PATH_TO_CONTENT\myfile.php```

@simonpca
Copy link

I'm getting what seems to be the same error there.

Works when uploading a file that's not at the root of the workspace but throws this error when the file to upload is.

[info] config at (path) {"remotePath":"./","uploadOnSave":true,"downloadOnOpen":false,"ignore":[],"concurrency":1,"protocol":"ftp","connectTimeout":10000,"interactiveAuth":false,"secure":false,"passive":false,"remoteTimeOffsetInHours":0,"port":21,"name":"NAME","host":"HOST","username":"******","password":"******","remote_path":"/DIRECTORY/wp-content/themes/THEMENAME"}
[info] [file-save] /Users/Lunatikzx/_sandbox/DIRECTORY/404.php
[error] Error: Can't create directory: File exists
    at v (/Users/Lunatikzx/.vscode/extensions/liximomo.sftp-1.9.1/dist/extension.js:70:106152)
    at d.<anonymous> (/Users/Lunatikzx/.vscode/extensions/liximomo.sftp-1.9.1/dist/extension.js:70:106875)
    at emitTwo (events.js:126:13)
    at d.emit (events.js:214:7)
    at d.module.exports.d._write (/Users/Lunatikzx/.vscode/extensions/liximomo.sftp-1.9.1/dist/extension.js:70:119697)
    at doWrite (_stream_writable.js:387:12)
    at writeOrBuffer (_stream_writable.js:373:5)
    at d.Writable.write (_stream_writable.js:290:11)
    at Socket.p (/Users/Lunatikzx/.vscode/extensions/liximomo.sftp-1.9.1/dist/extension.js:70:109246)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at TCP.onread (net.js:594:20) download /Users/Lunatikzx/_sandbox/DIRECTORY/404.php

@liximomo
Copy link
Owner

@simonpca File a new issue.

Repository owner locked as resolved and limited conversation to collaborators Jan 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants