Skip to content

[BUG] EACCES Error with Windows 11 App Execution Aliases #157

Description

@gdavidkov

Is there an existing issue for this?

  • I have searched the existing issues

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:

  1. Appear as regular .exe files in directory listings
  2. Can be executed normally from command line
  3. Cannot be accessed with fs.stat() or fs.statSync() - these operations throw EACCES errors
  4. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions