[Feature] yarn plugin remove / friendlier error message for missing plugins
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
- I'd be willing to implement this feature
- This feature can already be implemented through a plugin
Describe the user story
Looks like the latest berry now ships with the workspace-tools plugin already bundled.
After updating, I started running into errors such as:
yarn workspace workspace1 build-release
Ambiguous Syntax Error: Cannot find who to pick amongst the following alternatives:
0. yarn workspace <workspaceName> <commandName> ...
1. yarn workspace <workspaceName> <commandName> ...
While running workspace workspace1 build-release
With some help on discord, I found out about that this could happen because the plugin is duplicated between core and the separately installed one.
I looked for a way to remove the plugin, but the documentation doesn't mention what to do, so I attempted to delete the file from .yarn/plugins, which led to the following error afterwards when running any yarn command:
$ yarn
Internal Error: Cannot find module '/home/.../.yarn/plugins/@yarnpkg/plugin-workspace-tools.js'
Require stack:
- /home/.../.yarn/releases/yarn-sources.js
Require stack:
- /home/.../.yarn/releases/yarn-sources.js
I found the plugin referenced in .yarnrc.yml and also removed it from there, which got yarn working again.
Describe the solution you'd like
It would be nice if a command to remove a plugin was available, perhaps yarn plugin remove workspace-tools. With yarn installed globally it may be even harder to figure out how to remove plugins.
Additionally, a friendlier error message than the cannot find module would be nice. Perhaps one that would point to .yarnrc.yml so users know how to resolve it.
Describe the drawbacks of your solution
Can't think of any.
Describe alternatives you've considered
Can be solved manually, but the experience is confusing.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The report points to .yarnrc.yml, .yarn/plugins, and .yarn/releases/yarn-sources.js; begin by tracing how the duplicate workspace-tools plugin and missing plugin reference produce the reported errors. Use the shown yarn plugin, yarn workspace, and yarn commands to reproduce the behavior; done means a plugin removal command exists and missing plugins produce guidance that identifies the configuration to fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100