Skip to content

Node cannot handle extended windows paths #62446

@Mehgugs

Description

@Mehgugs

Version

v25.1.0

Platform

Microsoft Windows NT 10.0.26200.0 x64

Subsystem

fs

What steps will reproduce the bug?

Running node using an extended path like so: node \\?\C:\absolute\path\to\file.js

How often does it reproduce? Is there a required condition?

Any absolute path prefixed by \\?\

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

The script is executed; or if the script file does not exist an error stating the file could not be found.

What do you see instead?

node:fs:2710
    const out = binding.lstat(base, false, undefined, true /* throwIfNoEntry */);
                        ^

Error: EISDIR: illegal operation on a directory, lstat 'C:'
    at Object.realpathSync (node:fs:2710:25)
    at toRealPath (node:internal/modules/helpers:62:13)
    at Module._findPath (node:internal/modules/cjs/loader:774:22)
    at resolveMainPath (node:internal/modules/run_main:35:21)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:146:20)
    at node:internal/main/run_main_module:33:47 {
  errno: -4068,
  code: 'EISDIR',
  syscall: 'lstat',
  path: 'C:'
}

Additional information

This may have been introduced by #55623

Microsoft provide documentation on the path prefixes and semantics here: https://learn.microsoft.com/en-gb/windows/win32/fileio/naming-a-file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions