Node 22 broke `readdir` on Windows UNC paths
Version
22.15.0
Platform
Microsoft Windows NT 10.0.26100.0 x64
Subsystem
fs
What steps will reproduce the bug?
~\repos\clipboard-sync v0.16.2 ❯ volta run --node 20 node --eval 'console.log(require("fs").readdirSync("S:\\\\"))' 20:09:08 [ 'FELIPE-DESKTOP.is-receiving.txt' ] ~\repos\clipboard-sync v0.16.2 ❯ volta run --node 22 node --eval 'console.log(require("fs").readdirSync("S:\\\\"))' 20:09:58 node:fs:1584 const result = binding.readdir( ^ Error: ENOENT: no such file or directory, scandir 'S:\\' at Object.readdirSync (node:fs:1584:26) at [eval]:1:27 at runScriptInThisContext (node:internal/vm:209:10) at node:internal/process/execution:449:12 at [eval]-wrapper:6:24 at runScriptInContext (node:internal/process/execution:447:60) at evalFunction (node:internal/process/execution:87:30) at evalScript (node:internal/process/execution:99:3) at node:internal/main/eval_string:74:3 { errno: -4058, code: 'ENOENT', syscall: 'scandir', path: 'S:\\\\' } Node.js v22.15.0
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
To work, like it always used to.
What do you see instead?
ENOENT.
Additional information
I noticed this when upgraded my application from Electron 34 to 35, which also upgraded Node from 20 to 22. Maybe this is related to:
Whatever was done there may have broken other cases.