atinux / node-ftps

FTP, FTPS and SFTP client for node.js, mainly a lftp wrapper.
MIT License
202 stars 57 forks source link

i am getting this error when i try to connect to ftp. #65

Open nadunlanka opened 6 years ago

nadunlanka commented 6 years ago
var ftps = new FTPS({
  host: '192.168.1.8', // required
  username: 'test', // Optional. Use empty username for anonymous access.
  password: '123', // Required if username is not empty, except when requiresPassword: false
  protocol: 'ftp', // Optional, values : 'ftp', 'sftp', 'ftps', ... default: 'ftp'
  // protocol is added on beginning of host, ex : sftp://domain.com in this case
  port: 21, // Optional
  // port is added to the end of the host, ex: sftp://domain.com:22 in this case
  escape: true, // optional, used for escaping shell characters (space, $, etc.), default: true
  retries: 2, // Optional, defaults to 1 (1 = no retries, 0 = unlimited retries)
  timeout: 10, // Optional, Time before failing a connection attempt. Defaults to 10
  retryInterval: 5, // Optional, Time in seconds between attempts. Defaults to 5
  retryMultiplier: 1, // Optional, Multiplier by which retryInterval is multiplied each time new attempt fails. Defaults to 1
  requiresPassword: true, // Optional, defaults to true
  autoConfirm: true, // Optional, is used to auto confirm ssl questions on sftp or fish protocols, defaults to false
  cwd: '', // Optional, defaults to the directory from where the script is executed
  additionalLftpCommands: '', // Additional commands to pass to lftp, splitted by ';'
  requireSSHKey:  false, //  Optional, defaults to false, This option for SFTP Protocol with ssh key authentication
});

ftps.ls().exec(resp =>{
  console.log(resp)
  resolves(resp)

})

{ Error: spawn lftp ENOENT at _errnoException (util.js:1022:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19) at onErrorNT (internal/child_process.js:372:16) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn lftp', path: 'lftp', spawnargs: [ '-c', 'set net:max-retries 2;set net:timeout 10;set net:reconnect-interval-base 5;set net:reconnect-interval-multiplier 1;;open -u "test","123" "ftp://192.168.1.8:21";ls' ] }

roblayton commented 6 years ago

You probably need to install lftp on your machine/server. See this closed issue: https://github.com/Atinux/node-ftps/issues/21

nitingautam commented 5 years ago

I have installed lftp and in local when i try to call lftp it shows me lftp prompt. Still same error as shown above

henkomoss commented 2 years ago

Im having this very same issue. Did you find a solution?

SebaInfante commented 2 years ago

Im having this very same issue :/