xaander1
xaander1

Reputation: 1160

Docker getting error FATAL EISDIR: illegal operation on a directory, read

Stumbled across this error as I try to run NPM on my docker container.

 FATAL  EISDIR: illegal operation on a directory, read                                                                                      19:05:13

  at Object.readSync (node:fs:723:3)
  at tryReadSync (node:fs:433:20)
  at Object.readFileSync (node:fs:479:19)
  at loadEnv (node_modules/@nuxt/config/dist/config.js:1152:78)
  at Object.loadNuxtConfig (node_modules/@nuxt/config/dist/config.js:1070:15)
  at loadNuxtConfig (node_modules/@nuxt/cli/dist/cli-index.js:338:32)
  at NuxtCommand.getNuxtConfig (node_modules/@nuxt/cli/dist/cli-index.js:463:26)
  at Object.run (node_modules/@nuxt/cli/dist/cli-start.js:115:30)
  at NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:413:22)

So in my case npm install worked just fine....when you try to run the app with npm run start your greeted with the above error.

Upvotes: 2

Views: 4477

Answers (1)

xaander1
xaander1

Reputation: 1160

What it was not:

  • File permission issue - was running command as root
  • .npmrc in the same directory or user directory issue

Solution

Add all your python virtual environment folders to .dockerignore in my case i wasn't even copying the virtual environment folder to my docker container. Its existence is what caused the issue.

Example

.dockerignore

/api/.env

Its weird and I don't know why this is happening...but i spent days trying to figure out why my build worked on deployment but wouldn't work locally - python virtual environments are ignored during deployment so they were never there during cloud build thats why it worked.

Here is more resource regarding the issue however these did not work for me:

Upvotes: 3

Related Questions