EISDIR: illegal operation on a directory when enable Remote Debug in Managed workflow

The issue started for me after I updated the expo cli

I recently set up my environment, and I am also experiencing this error. Running the app works, but the issue arises whenever I enable Debug remote JS.

By running expo diagnostics, here’s my result:

EDIT: This is a bug in react-native and is unrelated to source maps. See Brent’s message at the end of the thread.

Hi @akinwalehabib, @shubhangh, @bombillazo, @eiire, @ldwight, @igor4505

I found a post about this here:

https://www.gitmemory.com/issue/facebook/metro/658/821060046

This person says that the problem went away when they disabled source maps in Chrome. Could you see if you get errors in Chrome about source maps at the same time as you get the EISDIR error?

If so, as a test, could you try disabling the source maps in chrome? If that gets past the problem then it seems like there might be something wrong with Metro wrt. source maps.

@shubhangh if this happened after an expo-cli upgrade, can you see which version of expo-cli worked for you and which version fails? I see expo-cli versions 4.7.0, 4.7.2 and 4.9.1 mentioned in the expo diagnostics output above.

Hey @wodin, let me quickly give this a try and circle back.

Another thing you might try:

Clear your metro cache with: expo start -c

Let us know how it goes

I diabled the source maps in Google Chrome browser, and the issue persiss:

About to clear the expo cache to see if that works. Another thing is I just set up my environment on Mac, so this is a fresh install. This happened from create_react_native

Hey @shubhangh what cli version were you using before?

Hi @bycedric , thanks for helping out. Simply install create-react-app afresh using macOS catalina. That’s what I am experiencing. I scaffolded a new project using create-react-app, and I am unable to view logs, which results in the reported error.

What OS do you use @bycedric ?

Hi all, to investigate this further we would need a reproducible project. If any of you can send me a Github project, which has this issue, I’d be happy to take a look!

You can share the link here, or ping me on our Discord chat (Cedric).

2 Likes

I gave up on debugging after days of metro-messing and just did console logging, but now I really need to debug and this is still happening.
upgraded to SDK 42 (exercising magical thinking) but did not fix it.
Disabling the source maps means I can’t debug, so that’s not helpful, but also doesn’t seem to fix it.
will try to make a new project tomorrow to share.

Sure. I was just trying to narrow down the problem based on someone claiming that disabling sourcemaps got rid of the errors. It’s obviously not an actual solution.

sorry if that came across snarky - didn’t mean it to.

after typing that, all hell broke loose on my machine- the cursor started moving on its own, the simulator froze, and my language became quite foul.

I am wondering if something is getting trampled when in debug? I ran my app fine on the simulator until I tried to go into debug.

can try shrinking my app to get a reproducible problem tomorrow if no on else has yet.

That’s OK, I didn’t take it that way.

:astonished:

That would be great, thanks.

ok. Spent a couple hours peeling code away from my app, only to find out that I can make this happen with a brand new project created with expo init!

here’s how:
expo init demo
expo start -c
i (for ios simulator. opens SE 14.4 on my device)
m (for menu on simulator)
enable remote debugging
it opens a tab in my Brave browser
when i right click/ inspect to get into debug, this appears in my terminal:

Running application on Valle Phone (SE).
Error: EISDIR: illegal operation on a directory, read
at Object.readSync (fs.js:614:3)
at tryReadSync (fs.js:383:20)
at Object.readFileSync (fs.js:420:19)
at UnableToResolveError.buildCodeFrameMessage (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:304:17)
at new UnableToResolveError (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:290:35)
at ModuleResolver.resolveDependency (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:168:15)
at DependencyGraph.resolveDependency (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph.js:353:43)
at /Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/lib/transformHelpers.js:271:42
at Server. (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/Server.js:842:41)
at Generator.next ()
Error: EISDIR: illegal operation on a directory, read
at Object.readSync (fs.js:614:3)
at tryReadSync (fs.js:383:20)
at Object.readFileSync (fs.js:420:19)
at UnableToResolveError.buildCodeFrameMessage (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:304:17)
at new UnableToResolveError (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:290:35)
at ModuleResolver.resolveDependency (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:168:15)
at DependencyGraph.resolveDependency (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph.js:353:43)
at /Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/lib/transformHelpers.js:271:42
at Server. (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/Server.js:842:41)
at Generator.next ()
Error: EISDIR: illegal operation on a directory, read
at Object.readSync (fs.js:614:3)
at tryReadSync (fs.js:383:20)
at Object.readFileSync (fs.js:420:19)
at UnableToResolveError.buildCodeFrameMessage (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:304:17)
at new UnableToResolveError (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:290:35)
at ModuleResolver.resolveDependency (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:168:15)
at DependencyGraph.resolveDependency (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/node-haste/DependencyGraph.js:353:43)
at /Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/lib/transformHelpers.js:271:42
at Server. (/Users/lili/GalacticSmarties/Dev/demo/node_modules/metro/src/Server.js:842:41)
at Generator.next ()

Also, although the source displays in the debugger, there is no green dot next to App.js to indicate that it is reachable, and setting a breakpoint confirms that it is not.

I hope this helps

Hi- I am able to consistently recreate this - please see my reply to Wodin below.

Hmmm…

Could you put some console.log() statements around the lines it’s complaining about to find out the name of the directory it’s complaining about?

@ldwight, @bycedric I can reproduce the error.

If I patch metro’s ModuleResolution.js to log this.originModulePath and then return null I get the following:

Logs for your project will appear below. Press Ctrl+C to exit.
*** EISDIR /Users/michael/work/personal/scratch/debugger-eisdir/.
Error: Unable to resolve module ./debugger-ui/debuggerWorker.aca173c4.js from /Users/michael/work/personal/scratch/debugger-eisdir/.:

None of these files exist:
  * debugger-ui/debuggerWorker.aca173c4.js(.native|.native.ts|.ts|.native.tsx|.tsx|.native.js|.js|.native.jsx|.jsx|.native.json|.json)
  * debugger-ui/debuggerWorker.aca173c4.js/index(.native|.native.ts|.ts|.native.tsx|.tsx|.native.js|.js|.native.jsx|.jsx|.native.json|.json)
    at ModuleResolver.resolveDependency (/Users/michael/work/personal/scratch/debugger-eisdir/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:168:15)
    at DependencyGraph.resolveDependency (/Users/michael/work/personal/scratch/debugger-eisdir/node_modules/metro/src/node-haste/DependencyGraph.js:353:43)
    at /Users/michael/work/personal/scratch/debugger-eisdir/node_modules/metro/src/lib/transformHelpers.js:271:42
    at Server.<anonymous> (/Users/michael/work/personal/scratch/debugger-eisdir/node_modules/metro/src/Server.js:842:41)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/michael/work/personal/scratch/debugger-eisdir/node_modules/metro/src/Server.js:99:24)
    at _next (/Users/michael/work/personal/scratch/debugger-eisdir/node_modules/metro/src/Server.js:119:9)

So for some reason it’s trying to read “.”

I applied a patch on metro package using patch-package but I get this error https://github.com/facebook/react-native/issues/28844 instead.
Try another emulator but stilll having this error.

please refer to the issue you referenced for information on how to solve this. it is an upstream bug with react-native itself

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.