Skip to content

node --run aborts on filesystem errors #67269

Open

Description

@jazelly

Version

v28.0.0-pre

Platform

Darwin 25.6.0 arm64

Subsystem

fs

What steps will reproduce the bug?

  1. A node_modules directory in the project (or any parent) that cannot be read:
mkdir -p proj && cd proj
echo '{"scripts":{"hi":"echo hi"}}' > package.json
mkdir node_modules && chmod 000 node_modules
node --run hi
  1. The current working directory has been removed:
mkdir gone && cd gone && rmdir ../gone
node --run hi

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

Always

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

  1. The unreadable node_modules/.bin is skipped and the script runs, as it does when node_modules has no .bin.
  2. A regular error message and exit code 1, like the existing Can't find package.json error.

What do you see instead?

The process aborts with exit code 134:

libc++abi: terminating due to uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in posix_stat: failed to determine attributes for the specified path: Permission denied [".../proj/node_modules/.bin"]
libc++abi: terminating due to uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in current_path: call to getcwd failed: No such file or directory

Additional information

No response

Activity

  1. added
    fsIssues and PRs related to file-system APIs and the fs module.
    on Nov 5, 2026
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

    fsIssues and PRs related to file-system APIs and the fs module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions