Skip to content

[Bug?]: directories referenced in directories.bin in package.json gets included in bin #7036

@yorch

Description

@yorch

Self-service

  • I'd be willing to implement a fix

Describe the bug

When a package has a directories.bin declaration, and the referenced directory has subdirectories, those get included in bin. Yarn then fails with an error when trying to run any commands.

Internal Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:738:18)

To reproduce

Install a dependency that declares directories.bin (like: https://github.com/brenapp/robotevents/blob/master/package.json#L27). Installation of deps will run file.

Lock file will contain something like:

"robotevents@npm:6.0.4":
  version: 6.0.4
  resolution: "robotevents@npm:6.0.4"
  dependencies:
    openapi-fetch: "npm:^0.11.1"
  bin:
    events.js: out/endpoints/events.js
    generated: out/generated
    robotevents.d.ts: out/generated/robotevents.d.ts
    robotevents.js: out/generated/robotevents.js
    ...

generated: out/generated is a directory, not a file, so when running any commands with yarn in that repo, for instance, yarn lint, it will trigger the error:

Internal Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:738:18)

Environment

System:
    OS: macOS 26.1
    CPU: (14) arm64 Apple M4 Pro
  Binaries:
    Node: 24.13.0 - /private/var/folders/8k/4fndfdfj4_5g3wtn81flknf784320jn/T/xfs-e22348840/node
    Yarn: 4.12.0 - /private/var/folders/8k/4fndfdfj4_5g3wtn81flknf784320jn/T/xfs-e22348840/yarn
    npm: 11.6.2 - /Users/user/.local/state/fnm_multishells/18077_123477714321/bin/npm

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions