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

Viewed 71924

When ever I try to open a file I get,

events.js:72
        throw er; // Unhandled 'error' event
Error: EISDIR, read
4 Answers

This error is simple,

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

EISDIR means that the target of the operation is a directory in reality but that the expected filetype of the target is something other than a directory.

You might get lucky checking for such error codes by running something like:

grep EISDIR -r /usr/include

When I do this, I get a line that says:

/usr/include/uv.h:  XX(EISDIR, "illegal operation on a directory")
Related