Eisdir illegal operation on a directory read

I am stuck with this error no matter what directory I am in, and what I type after “npm” in cmd.exe. Here is the npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: EISDIR: illegal operation on a directory, read
4 verbose stack     at Error (native)
5 verbose cwd C:\Users\me
6 error Windows_NT 6.1.7601
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"
8 error node v4.2.6
9 error npm  v2.14.12
10 error code EISDIR
11 error errno -4068
12 error syscall read
13 error eisdir EISDIR: illegal operation on a directory, read
13 error eisdir This is most likely not a problem with npm itself
13 error eisdir and is related to npm not being able to find a package.json in
13 error eisdir a package you are trying to install.
14 verbose exit [ -4068, true ]

I have tried and uninstalling/reinstalling nodejs multiple times, I even deleted npm and npm-cache folders in C:\Users\me\AppData\Roaming. I’m not sure what went wrong to cause this. One second it was working fine, and now I can’t get rid of this error. The explanation in the log does not make sense, as it gives this error in any directory. I should note that running a command prompt as administrator does not give this error. I’m pulling my hair out this Friday evening trying to get this fixed, any help would be greatly appreciated!

Best Answer

EISDIR stands for “Error, Is Directory“. This means that NPM is trying to do something to a file but it is a directory. In your case, NPM is trying to “read” a file which is a directory (Line: 4). Since the operation cannot be done the error is thrown.

Three things to make sure here.

  1. Make sure the file exists. If it does not, you need to create it. (If NPM depends on any specific information in the file, you will need to have that information there).
  2. Make sure it is in fact a file and not a directory.
  3. It has the right permissions. You can change the file to have all permissions with “sudo chmod 777 FILE_NAME”. (Careful: You are giving Read, Write and Execute permissions to every one on that file)

You may Also Like:

I am getting an issue with my web app hosted on linux app service plan which is a static next js site and is running perfectly fine in Azure storage with cdn & window based web app (with extra files like web.config & server.js)

I would like to run this in Azure web app (Linux app service plan) but the refresh is not working except for the home page. This works perfectly in my local as well. I have below settings in my web app

Eisdir illegal operation on a directory read

Suppose my website homepage URL is xyz.azurewebsites.net and when I navigate to the help page (xyz.azurewebsites.net/professionals) it works fine. But, if I refresh the page or try to go to the URL directly it gives me below error

Eisdir illegal operation on a directory read


azure-webapps-development

Jason Walker

unread,

Jan 22, 2019, 11:53:07 AM1/22/19

to Firebase Google Group

I repeatedly receive this error when deploying my hosting project: Error: EISDIR: illegal operation on a directory, read 

Anyone have guidance to offer on how to address the error?  

I should note that this folder is on the google file stream 'G drive' of my computer.  

Below is screenshot of error and contents of the .log file, redacted a bit.

Eisdir illegal operation on a directory read

Heres the contents of firebase-debug.log:

[debug] [2019-01-22T17:30:46.339Z] ----------------------------------------------------------------------

[debug] [2019-01-22T17:30:46.342Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\jason\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js deploy

[debug] [2019-01-22T17:30:46.342Z] CLI Version:   6.3.0

[debug] [2019-01-22T17:30:46.342Z] Platform:      win32

[debug] [2019-01-22T17:30:46.342Z] Node Version:  v8.12.0

[debug] [2019-01-22T17:30:46.343Z] Time:          Tue Jan 22 2019 12:30:46 GMT-0500 (Eastern Standard Time)

[debug] [2019-01-22T17:30:46.343Z] ----------------------------------------------------------------------

[debug] 

[debug] [2019-01-22T17:30:46.368Z] > authorizing via signed-in user

[debug] [2019-01-22T17:30:46.369Z] [iam] checking project ---online for permissions ["firebase.projects.get","firebasehosting.sites.update"]

[debug] [2019-01-22T17:30:46.602Z] <<< HTTP RESPONSE 200

[debug] [2019-01-22T17:30:47.277Z] <<< HTTP RESPONSE 200

[info] 

[info] === Deploying to '---online'...

[info] 

[info] i  deploying hosting

[debug] [2019-01-22T17:30:48.376Z] <<< HTTP RESPONSE 200

[info] i  hosting[---online]: beginning deploy...

[info] i  hosting[---online]: found 1587 files in public

[debug] [2019-01-22T17:30:50.161Z] [hosting] hash cache [cHVibGlj] not populated

[debug] [2019-01-22T17:30:50.359Z] Error: EISDIR: illegal operation on a directory, read

[error] 

[error] Error: An unexpected error has occurred.

Michael Bleigh

unread,

Jan 22, 2019, 12:07:04 PM1/22/19

to Firebase Google Group

Can you try deleting the .firebase directory in your project folder? If you point your public folder at something simpler (e.g. a folder with one text file in it) does it work?


Jason Walker

unread,

Jan 22, 2019, 2:08:07 PM1/22/19

to Firebase Google Group

I deleted the .firebase folder, did firebase deploy, but got a different error.... screenshot:

Eisdir illegal operation on a directory read

Jason Walker

unread,

Jan 22, 2019, 2:08:18 PM1/22/19

to Firebase Google Group

If I take the folder and copy it to my C Drive (literally to the windows desktop, and run firebase deploy, then it works!

I noticed that upon copying the folder, I get errors with some google drawing files (.draw), they cant 'copy' over so I have to skip them in the copy process.  Perhaps its related to those files?  Or otherwsie related to the fact this folder is on the 'G: drive' created by google file stream?

On Tuesday, January 22, 2019 at 2:07:04 PM UTC-5, Michael Bleigh wrote:

Jason Walker

unread,

Jan 22, 2019, 4:56:50 PM1/22/19

to Firebase Google Group

I think I've isolated the problem. The .gdraw files present in the public directory seem to be directly related with the error. I moved those particular files outside of the public folder and was able to deploy as expected.

Mackonen J

unread,

Jan 27, 2019, 7:36:28 PM1/27/19

to Firebase Google Group

Try locating and removing the .npmrc folder that is located in c:/users/your username/.npmrc

How do you fix Eisdir illegal operation on a directory read?

Three things to make sure here..
Make sure the file exists. If it does not, you need to create it. ... .
Make sure it is in fact a file and not a directory..
It has the right permissions. You can change the file to have all permissions with "sudo chmod 777 FILE_NAME". (.

What is Eisdir?

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.