nodejs / nodejs/node

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

未关闭
#60,435 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

stale windows
主要语言
JavaScript
星标
122k
派生
37.3k
平均合并
4 天 2 小时
30 天内合并 PR
283

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,在 Windows 22.20.0 上使用长 \?\ 路径复现 child_process.execFileSync,然后将结果与 Node 20.19.0 进行比较。跟踪报告的路径经过 internal/modules/helpers、internal/modules/cjs/loader 和 internal/modules/run_main;受影响的路径模式能够成功执行且不出现 EISDIR lstat 错误,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, node.js
领域
backend, operating-systems
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。