Using Node.js, I get: "Error: EISDIR reading"

When I try to open the file, I get

events.js:72 throw er; // Unhandled 'error' event Error: EISDIR, read 
+42
Dec 06 '13 at 6:03
source share
3 answers

This mistake is simple

 cd /tmp mkdir dir node -e "var fs = require('fs'); fs.createReadStream( 'dir' );" 

EISDIR means that the target of the operation is the directory in reality, but the expected file type of the target is something other than the directory.

+64
Dec 06 '13 at 6:03
source share

I just stumbled upon this error, and in my case, she used bower link earlier to communicate with local sources, which then creates a symbolic link in the directory. When I bower unlink edited all the components, it worked again as expected.

Hope this can help someone.

+4
Nov 26 '15 at 16:08
source share

EISDIR An error occurs when trying to open a file, but the specified path is a directory.

You can fix this by setting whether it is a directory -

 if (fs.lstatSync(filePath).isDirectory()) { return; } 

See the docs here for more details.

0
May 26 '17 at 16:43
source share



All Articles