yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.43k stars 1.11k forks source link

[Bug?]: Missing .bin Folder in node_modules with yarn nodeLinker set to pnpm #6171

Open alex-misch opened 7 months ago

alex-misch commented 7 months ago

Self-service

Describe the bug

When using the nodeLinker setting set to pnpm, the .bin folder in node_modules is not created after installing dependencies, unlike when using other configurations.

To reproduce

Using nodeLinker with pnpm

yarn init -2
yarn set version 4
yarn config set nodeLinker pnpm
yarn add eslint

results in the .bin folder not being created.

Screenshot 2024-03-17 at 17 28 27

Using nodeLinker with node-modules

yarn init -2
yarn set version 4
yarn config set nodeLinker node-modules
yarn add eslint

results in the .bin/eslint folder being created

Screenshot 2024-03-17 at 17 30 23

Using pnpm Directly

pnpm init
pnpm install eslint

also results in the .bin/eslint folder being created

Screenshot 2024-03-17 at 17 32 22

Environment

System:
    OS: macOS 13.6
    CPU: (10) arm64 Apple M2 Pro
  Binaries:
    Node: 20.7.0 - /private/var/folders/v5/qmd767md03d0f349sr3pqjr80000gn/T/xfs-13fe14d0/node
    Yarn: 3.6.3 - /private/var/folders/v5/qmd767md03d0f349sr3pqjr80000gn/T/xfs-13fe14d0/yarn
    npm: 10.2.0 - ~/.nvm/versions/node/v20.7.0/bin/npm
    pnpm: 8.13.1 - ~/Library/pnpm/pnpm
  npmPackages:
    jest: 29.7.0 => 29.7.0

Additional context

This behavior is confusing, as some libraries, such as appcenter, rely on executing binaries from the node_modules/.bin/ directory.

broofa commented 3 months ago

I'm seeing this issue as well (w/ yarn@4.3.1). This breaks our ability to use tsc, eslint, and prettier on the command-line (among others). Edit: Okay, it doesn't really break our ability to run CLIs, but it does seem to require that we use yarn run to invoke them — E.g. yarn run tsc — which is less than ideal given this issue. 😞

FWIW, I reached out to the yarn support channel on Discord to see if there was a specific reason for this omission. @arcanis responded, "It hasn't been a problem enough to prompt someone to open a PR".

alex-misch commented 3 months ago

Thank you for the update. We have migrated to pnpm in our architecture, so this issue no longer affects us. If anyone is interested in submitting a pull request to fix this bug, please feel free to do so.