0

i am right now debugging one system and in the log i am getting ENOENT lstat error. code is as follows. fs.lstat(self.file, function(err, stats) { if(err) { //rest of the code. return; }

What i want to know is what is the possible reason of ENOENT error. Thank you in advance.

1 Answers1

4

ENOENT means there is no such file or directory.

BlackJack
  • 4,476
  • 1
  • 20
  • 25
  • That's obvious, Post a possible solution if you have any. – Salman Aug 14 '14 at 13:30
  • 2
    @Салман What do you mean by „solution”? To which problem? I've answered the question. That's the possible reason why `fstat()` returns `ENOENT`. If the OP wanted to know something different, the question should have been different. ;-) – BlackJack Aug 14 '14 at 14:36
  • Possible solution: remove the `fs.lstat` call from the code. Code that doesn't exist cannot fault. – msw Aug 14 '14 at 16:35
  • Why should i remove fs.lstat() ? This is a code which read my files in Async mode. – Codeforgeek Aug 18 '14 at 04:43
  • @Codeforgeek That comment was tongue in cheek I guess. Although `fs.lstat()` does not read files and you can't read files that are apparently non existent anyway. To be more serious: Obviously you are expecting files that are not there or `self.file` doesn't contain what you think it contains. It's not possible to help you without more information. Best would be a [Short, Self Contained, Correct Example](http://www.sscce.org/). – BlackJack Aug 18 '14 at 13:51
  • Hi @BlackJack , i have tested my code with some cases, cases such as after execution of script moving the file into other location or deletion of files and i get the same error as such. Path is correct as per my team lead. Sorry for fs.lstat() file read crap. I was wrong in that. – Codeforgeek Aug 19 '14 at 09:16