Error: connect ECONNREFUSED 127.0.0.1:21
NeevJewalkar opened this issue · 2 comments
NeevJewalkar commented
I am new to ftp, so i tried one of the examples
var Client = require('ftp');
var fs = require('fs');
var c = new Client();
c.on('ready', function() {
c.put('foo.txt', 'foo.remote-copy.txt', function(err) {
if (err) throw err;
c.end();
});
});
// connect to localhost:21 as anonymous
c.connect();
I created the foo.txt file, having 'test' in it
when i run the script, it gives me the error
events.js:291
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 127.0.0.1:2
1```
please help me, i dont know what i am doing wrong
mateus4k commented
You need to pass the connection parameters:
c.connect({
host: '',
password: '',
user: ''
})
Deleted user commented
works now, thanks!