question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] `yarn workspaces foreach exec` fails

See original GitHub issue
  • I’d be willing to implement a fix

Describe the bug

yarn workspaces foreach exec fails

To Reproduce

I am trying to run depcheck in every workspace, but it seems that exec, while a valid yarn command, is not passed through by yarn workspaces foreach. Is this a bug or is exec not meant to be supported?

yarn workspaces foreach exec depcheck

Usage Error: Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
paul-soporancommented, Aug 26, 2020

@DerekZiemba You’re using Yarn Classic (v1), while yarn workpaces foreach is a Yarn 2 feature. You can consult the installation guide to install Yarn 2. If it still doesn’t work, you should probably open another issue, as it’s unlikely it would be related to this one.

1reaction
arcaniscommented, Jul 24, 2020

Yeah, but yarn workspaces foreach run depcheck won’t do a thing unless there are depcheck scripts in all workspaces. Is that expected behaviour?

It will skip over scripts that don’t declare a script of this name, yes. However it probably should execute it too if there’s a binary of the specified name, so if it doesn’t do so already I’d see that as a bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`yarn workspaces foreach` | Yarn - Package Manager
If the command is run and the script being run does not exist the child workspace will be skipped without error.
Read more >
Advanced package manager features for npm, Yarn, and pnpm
Don't think a lot about your package manager? Learn more in this article about the advances in package manager features you may have...
Read more >
Beware of Colons in Yarn Scripts - DEV Community ‍ ‍
A script with a colon in its name implicitly "exists" in every workspace, so yarn workspaces foreach run will always execute it in...
Read more >
A guide through The Wild Wild West of setting up a mono repo ...
We will be using TypeScript, Yarn workspaces, Lerna, and Jest. ... going to need the git history when someone discovers a bug after...
Read more >
Maël Twitterren: "8 ⚡️ You can use `yarn workspaces focus ...
It's a tiny bit slower, but you get the certainty that your project is in a good state if `yarn install` exits without...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found