question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: EISDIR: illegal operation on a directory, read

See original GitHub issue

Do you want to request a feature or report a bug? A bug I think.

What is the current behavior?

I have an project which is a react native project called th_views.rn and in the project there’s a folder which is still a react native project named examples

Then I run npm run android in examples which run the react-native run-android. Then the error show:

file:  /my_porject_path/th_views.rn/examples/.
Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:625:3)
    at tryReadSync (node:fs:390:20)
    at Object.readFileSync (node:fs:427:19)
    at UnableToResolveError.buildCodeFrameMessage (/Volumes/wd/Previous Content/source/th_libs/rn/th_views.rn/examples/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:347:17)
    at new UnableToResolveError (/Volumes/wd/Previous Content/source/th_libs/rn/th_views.rn/examples/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:333:35)
    at ModuleResolver.resolveDependency (/Volumes/wd/Previous Content/source/th_libs/rn/th_views.rn/examples/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:211:15)
    at DependencyGraph.resolveDependency (/Volumes/wd/Previous Content/source/th_libs/rn/th_views.rn/examples/node_modules/metro/src/node-haste/DependencyGraph.js:413:43)
    at /Volumes/wd/Previous Content/source/th_libs/rn/th_views.rn/examples/node_modules/metro/src/lib/transformHelpers.js:317:42
    at /Volumes/wd/Previous Content/source/th_libs/rn/th_views.rn/examples/node_modules/metro/src/Server.js:1471:14
    at Generator.next (<anonymous>)

which the code around is node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:

  buildCodeFrameMessage() {
    let file;

    try {
      file = fs.readFileSync(this.originModulePath, "utf8");
    } catch (error) {
      if (error.code === "ENOENT") {
        // We're probably dealing with a virtualised file system where
        // `this.originModulePath` doesn't actually exist on disk.
        // We can't show a code frame, but there's no need to let this I/O
        // error shadow the original module resolution error.
        return null;
      }

      
      // I add for show the folder
      console.log("file: ", this.originModulePath)
      throw error;
    }

And the folder which perform read on is: /my_porject_path/th_views.rn/examples/.

It’s strange that perform read on .. How can I debug or fix this. Thank you.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:39
  • Comments:28

github_iconTop GitHub Comments

10reactions
darrychen92commented, Apr 16, 2021

It seems like that the error occurs when I open Devtools.

I solved that according to the highest answer in this question https://stackoverflow.com/questions/61339968/devtools-failed-to-load-sourcemap-could-not-load-content-for-chrome-extension

6reactions
cavab97commented, Jan 17, 2022

i solved by this link here https://stackoverflow.com/questions/70405285/react-native-android-crashes-on-enabling-debug-mode ,react-native-reanimated no support on debug mode , some of the plugin no support debug mode, don’t forget to check the plugin you install

Read more comments on GitHub >

github_iconTop Results From Across the Web

NPM stuck giving the same error EISDIR: Illegal operation on ...
EISDIR stands for "Error, Is Directory". This means that NPM is trying to do something to a file but it is a directory....
Read more >
NPM stuck giving the same error EISDIR: Illegal operation on ...
Windows : NPM stuck giving the same error EISDIR : Illegal operation on a directory, read at error (native) [ Beautify Your Computer ......
Read more >
EISDIR: illegal operation on a directory when enable Remote ...
Error : EISDIR: illegal operation on a directory, read at Object.readSync (fs.js:614:3) at tryReadSync (fs.js:383:20) at Object.
Read more >
eisdir: illegal operation on a directory - You.com
EISDIR stands for "Error, Is Directory". This means that yarn is trying to do something to a file but it is a directory....
Read more >
Got some npm or yarn errors and can't install dependencies ...
node:events:371 throw er; // Unhandled 'error' event ^ Error: EISDIR: illegal operation on a directory, read Emitted 'error' event on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found