berry icon indicating copy to clipboard operation
berry copied to clipboard

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

Open alex-misch opened this issue 1 year ago • 2 comments

Self-service

  • [ ] I'd be willing to implement a fix

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.

alex-misch avatar Mar 17 '24 14:03 alex-misch

I'm seeing this issue as well (w/ [email protected]). ~~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".

broofa avatar Jul 23 '24 20:07 broofa

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.

alex-misch avatar Aug 07 '24 09:08 alex-misch

I also have this problem, and even with yarn run it doesn't work. We are trying to migrate Yarn v1 (Classic) to v4 (Berry), but PnP does not work with Nuxt and the pnpm nodeLinker does not create the .bin folder so everything fails after yarn install. We are left with node-modules nodeLinker or migrating to pnpm.

andresilva-cc avatar Jan 02 '25 20:01 andresilva-cc