noodny / node-ftp-client

MIT License
64 stars 32 forks source link

I am getting following error how to resolve it #23

Open vaibhavgatne opened 6 years ago

vaibhavgatne commented 6 years ago

module.js:549 throw err; ^

Error: Cannot find module 'ftp' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (H:\Techm\FTP\node-ftp-client-master\lib\client.js:4:7) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) My java script as below var ftpClient = require('./client.js'), config = { host: 'localhost', port: 21, user: 'anonymous', password: 'anonymous@' }, options = { logging: 'basic' }, client = new ftpClient(config, options);

client.connect(function () {

client.upload(['test/**'], '/public_html/test', {
    baseDir: 'test',
    overwrite: 'older'
}, function (result) {
    console.log(result);
});

client.download('/public_html/test2', 'test2/', {
    overwrite: 'all'
}, function (result) {
    console.log(result);
});

});

markpython86 commented 5 years ago

Have you done npm install before creating your download and upload functions?

noodny commented 5 years ago

Thanks @markpython86, that's right @vaibhavgatne, as you can see in https://github.com/noodny/node-ftp-client/blob/master/package.json#L34, ftp is a dependency of this module.