[Node.js] Error: EISDIR, illegal operation on a directory at Error (native)

Error:

fs.js:552  var r = binding.read(fd, buffer, offset, length, position);                  ^Error: EISDIR, illegal operation on a directory    at Error (native)    at Object.fs.readSync (fs.js:552:19)    at Object.fs.readFileSync (fs.js:384:28)    at /usr/eyeball/auth_server/js/server.js:98:15    at Socket.<anonymous> (/usr/eyeball/auth_server/js/util/process.js:11:5)    at Socket.emit (events.js:129:20)    at _stream_readable.js:908:16    at process._tickCallback (node.js:355:11)

This error happen when you use invalid file path for opening and reading using nodejs dependency library fs. 

Solution:

File must be the file path with the file name. Not the file directory.

Post a Comment