yarnpkg / yarnpkg/berry

[Bug?]: misconfigured yarn global script issue when executed with parallel flag

Open
#6,403 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
8.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Self-service
  • I'd be willing to implement a fix
Describe the bug

Yarn version I am on is 4.3.1 and it seems to be utilizing 100% of the cpu when a misconfigured global script is used.

To reproduce

I have created a repro here https://github.com/twlite/yarn-global-script-repro with a simple setup. This seems to occur only with the workspace.

Steps

  • create a simple workspace with at least 2 packages
  • add a root global script that also executes global script (:), preferably same name (in my original case, it was build:check)
  • make sure that script does not exist in any of the packages inside the workspace
  • execute the command yarn workspaces foreach --all -pt run <globalScriptName>
  • The script never stops and uses 100% of the cpu (my fan went jet mode)
Environment
System:
    OS: Windows 11 10.0.22631
    CPU: (28) x64 Intel(R) Core(TM) i7-14700K
  Binaries:
    Node: 22.2.0 - ~\AppData\Local\Temp\xfs-4bfc2d56\node.CMD
    Yarn: 4.3.1 - ~\AppData\Local\Temp\xfs-4bfc2d56\yarn.CMD
    npm: 10.5.2 - ~\AppData\Local\Volta\tools\image\npm\10.5.2\bin\npm.CMD
    pnpm: 9.4.0 - C:\Program Files\Volta\pnpm.EXE
    bun: 1.1.18 - ~\.bun\bin\bun.EXE
Additional context

I wanted to take a screenshot but it failed due to the stress on my cpu.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by cloning the linked reproduction and running the documented yarn workspaces foreach --all -pt run <globalScriptName> command with the root global script setup. Trace the workspace execution path that handles the missing package script, and consider the issue resolved when the command terminates without looping or consuming 100% CPU.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.