nodejs / nodejs/node

child_process.execFileSync fails with EISDIR: illegal operation on a directory, lstat 'C:' on Windows in Node.js 22.20.0

Open
#60,435 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

stale windows
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

v22.20.0

Platform
Microsoft Windows NT 10.0.26200.0 x64
Subsystem

No response

What steps will reproduce the bug?

Node.js 22.20.0 may have introduced a regression in module resolution where child_process.execFileSync() fails when executing binaries from certain Windows paths. The error occurs during internal module resolution and affects multiple path patterns.

Error: EISDIR: illegal operation on a directory, lstat 'C:'
    at Object.realpathSync (node:fs:2744:25)
    at toRealPath (node:internal/modules/helpers:61:13)
    at Module._findPath (node:internal/modules/cjs/loader:746:22)
    at resolveMainPath (node:internal/modules/run_main:39:23)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:163:20)
    at node:internal/main/run_main_module:36:49

Affected Path Patterns:

  • Very long paths (>260 characters) with \?\ prefix
How often does it reproduce? Is there a required condition?

Reproducible every time with long paths with \?\ prefix on Windows

What is the expected behavior? Why is that the expected behavior?

In node 20.19.0 tests with long paths with \?\ prefix were passing successfully

What do you see instead?
Error: EISDIR: illegal operation on a directory, lstat 'C:'
    at Object.realpathSync (node:fs:2744:25)
    at toRealPath (node:internal/modules/helpers:61:13)
    at Module._findPath (node:internal/modules/cjs/loader:746:22)
    at resolveMainPath (node:internal/modules/run_main:39:23)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:163:20)
    at node:internal/main/run_main_module:36:49 {
  errno: -4068,
  code: 'EISDIR',
  syscall: 'lstat',
  path: 'C:'
}
Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing child_process.execFileSync on Windows 22.20.0 with a long \?\ path, then compare the result with Node 20.19.0. Trace the reported path through internal/modules/helpers, internal/modules/cjs/loader, and internal/modules/run_main; done means the affected path pattern executes successfully without the EISDIR lstat error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.