Is there an existing issue for this?
Current Behavior
The node-which module (and its dependency isexe) encounters EACCES: permission denied errors when checking Windows 11 App Execution Aliases like mspaint.exe located in %LOCALAPPDATA%\Microsoft\WindowsApps\.
Error: EACCES: permission denied, stat 'C:\Users\username\AppData\Local\Microsoft\WindowsApps\mspaint.exe'
at statSync (node:fs:1740:25)
at t.statSync (node:electron/js2c/node_init:2:5407)
Windows 11 App Execution Aliases are special files that:
- Appear as regular
.exe files in directory listings
- Can be executed normally from command line
- Cannot be accessed with
fs.stat() or fs.statSync() - these operations throw EACCES errors
- Can be checked for existence using
fs.access()
- The
which module correctly returns null when using { nothrow: true }
- The
isexe module correctly returns false when using { ignoreErrors: true }
- Direct
fs.statSync() calls fail with EACCES
fs.accessSync() works correctly on the same files
Expected Behavior
Since mspaint.exe is a valid executable in the user's PATH that can be launched successfully, the expected behavior should be:
which.sync('mspaint') should return the path to the executable: C:\Users\username\AppData\Local\Microsoft\WindowsApps\mspaint.exe
isexe.sync(mspaintPath) should return true (indicating the file is executable)
- App Execution Aliases should be treated as valid executables since they:
- Have executable file extensions (
.exe)
- Are included in the system PATH
- Can be launched successfully from command line
- Are legitimate Windows applications
Steps To Reproduce
- Windows 11 system
- Node.js installed
which module installed (npm install which)
- MS Paint available as App Execution Alias (default on Windows 11)
const which = require('which');
const result = which.sync('mspaint');
console.log('Found mspaint at:', result);
Environment
- npm: 11.4.2
- Node: 22.15.0
- OS: Windows 11
- platform: Win32
The PR:
isaacs/isexe#40
Is there an existing issue for this?
Current Behavior
The
node-whichmodule (and its dependencyisexe) encountersEACCES: permission deniederrors when checking Windows 11 App Execution Aliases likemspaint.exelocated in%LOCALAPPDATA%\Microsoft\WindowsApps\.Windows 11 App Execution Aliases are special files that:
.exefiles in directory listingsfs.stat()orfs.statSync()- these operations throwEACCESerrorsfs.access()whichmodule correctly returnsnullwhen using{ nothrow: true }isexemodule correctly returnsfalsewhen using{ ignoreErrors: true }fs.statSync()calls fail withEACCESfs.accessSync()works correctly on the same filesExpected Behavior
Since
mspaint.exeis a valid executable in the user's PATH that can be launched successfully, the expected behavior should be:which.sync('mspaint')should return the path to the executable:C:\Users\username\AppData\Local\Microsoft\WindowsApps\mspaint.exeisexe.sync(mspaintPath)should returntrue(indicating the file is executable).exe)Steps To Reproduce
whichmodule installed (npm install which)Environment
The PR:
isaacs/isexe#40