Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: Yarn doesn't make dependency executables available on PATH for yarn run #6485

Open
1 task
nex3 opened this issue Sep 5, 2024 · 0 comments
Open
1 task
Labels
bug Something isn't working

Comments

@nex3
Copy link

nex3 commented Sep 5, 2024

Self-service

  • I'd be willing to implement a fix

Describe the bug

As I understand it (confirmed on the Yarn discord), yarn run should update the PATH environment to provide access to dependency URLs.

To reproduce

$ yarn init
$ yarn set version 4.4.1
$ yarn add gts
$ yarn run gts init -y # Note that this produces an unrelated error
$ yarn run gts lint
version: 22
$ echo $?
1

Debugging further, this is because it's trying to run execa('eslint', ...) but eslint isn't available on its PATH. Note that gts has a full, non-dev dependency on eslint, which declares

"bin": {
  "eslint": "./bin/eslint.js"
}

in its package.json.

Environment

System:
    OS: Linux 6.7 Debian GNU/Linux rodete
    CPU: (8) x64 Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz
  Binaries:
    Node: 22.2.0 - /tmp/xfs-bd8d55d4/node
    Yarn: 4.4.1 - /tmp/xfs-bd8d55d4/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v22.2.0/bin/npm

Additional context

To debug, I ran yarn config nodeLinker node-modules, yarn install, and then edited node_modules/gts/build/src/cli.js to inspect the environment. One new entry was added to by default PATH, /tmp/xfs-.... I printed the contents of this directory during the executable invocation, and it contained only:

[
  'gts',      'node',
  'node-gyp', 'run',
  'tsc',      'tsserver',
  'yarn',     'yarnpkg'
]

Note the absence of eslint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant