简体   繁体   English

节点未找到文件ENOENT错误

[英]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... 我尝试对文件进行chmod ,但无济于事...

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. 因此,它试图移动到您提供的路径,但从程序运行的路径开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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