Windows path handling issue requiring filesystem changes
Node.js fails to handle extended Windows paths (prefixed with \\?\) when executing scripts. The issue appears related to filesystem path resolution and may require changes to how Node processes Windows paths. The main challenge is ensuring compatibility with existing path handling while adding support for extended paths.
v25.1.0
Microsoft Windows NT 10.0.26200.0 x64
fs
Running node using an extended path like so: node \\?\C:\absolute\path\to\file.js
Any absolute path prefixed by \\?\
The script is executed; or if the script file does not exist an error stating the file could not be found.
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:'
}
This may have been introduced by https://github.com/nodejs/node/pull/55623
Microsoft provide documentation on the path prefixes and semantics here: https://learn.microsoft.com/en-gb/windows/win32/fileio/naming-a-file
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!