0

I don't know why this error occurred "error: SPAWN ls ENONET"

  • well.... there is simply no 'ls' command in windows, right? so you can do something to windows (to recognize ls command) or to your program to detect/take parameter about OS type and spawn a different process, like "dir" – Vladimir M Oct 22 '21 at 10:51
  • @VladimirM can you tell me how to do something with windows to take such commands? – AKSHAY KUMAR EKALRE Oct 22 '21 at 10:56
  • it all depends on what exactly you want. one way is to google for "ls for Windows 10" and find a link to MS shop with free ls utility for windows. Though, when you post a question on stackOverflow it is generally expected that you have spent some of your own time researching the problem. As a new user you might have not known that. – Vladimir M Oct 22 '21 at 11:05
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 22 '21 at 11:39

1 Answers1

0

I see that you are trying to use ls command, which does not exist on Windows, that is why you see the error.

What I would suggest you is to rely on fs module if you just want to list the content of the current directory. In general, you should avoid running CLI utilities if there is a native API that is available to you.

You can use fs.readDir function to replace ls.

Ayzrian
  • 2,279
  • 1
  • 7
  • 14