简体   繁体   中英

node no file found ENOENT error

I've tried the following code to copy file from server to local file i've created the local file (with the same name) on my root project and use the following

var conn = new Client();
conn.on('ready', function () {
conn.sftp(function (err, sftp) {
if (err) throw err;

            var moveFrom = "/home/app/html";
            var moveTo = "/Users/i034665/WebstormProjects/apptest/index.html";

            sftp.fastGet(moveFrom, moveTo, {}, function (downloadError) {
                if (downloadError) throw downloadError;

                console.log("Succesfully uploaded");
            });
        });
    }).connect({

The error is:

    if (downloadError) throw downloadError;
    2017-08-24T23:18:56.85+0300 [APP/PROC/WEB/0] ERR Error: ENOENT: no such file or directory, open '/Users/i034665/WebstormProjects/apptest/index.html'

But I've created the file in the path that I've provided , Do you have an idea what the problem could be ?

I try to chmod the file but it doesn't help...

The . means current directory. So it is trying to move to the path you provided but starting at the path that the program is running.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM