[Bug?]: yarn plugin import workspace-tools is broken??
See original GitHub issueSelf-service
- I’d be willing to implement a fix
Describe the bug
yarn plugin import workspace-tools command is broken since Sunday (7/25), this command runs successfully. But after that any yarn command throws error
To reproduce
Have .yarnrc.yml and typical yarn2 requirements in your app directory run yarn plugin import workspace-tools >> success yarn --version
this will show this error
Usage Error: This plugin cannot access the package referenced via typanion which is neither a builtin, nor an exposed entry (when initializing @yarnpkg/plugin-workspace-tools, defined in /github/workspace/.yarnrc.yml)
Yarn Package Manager - 2.4.1
$ yarn <command>
You can also print more details about any of these commands by calling them
after adding the `-h,--help` flag right after the command name.
Environment
OS: stretch/debian 9 It runs in github action agents, so dont know much other environment details, I can get those details if needed. But this is repro-ing in local docker container (debian based node 14 image) as well
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:15
- Comments:8 (2 by maintainers)
Top Results From Across the Web
[Bug] yarn plugin import resolving problem #722 - GitHub
I'd be willing to implement a fix Describe the bug I couldn't find this reported but ... yarn plugin import @yarnpkg/plugin-workspace-tools.
Read more >@yarnpkg/plugin-workspace-tools | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >Migrating our Monorepo to Yarn 2 | DoltHub Blog
Our front-end code lives in a directory within ld called web , which is split up into packages managed with Yarn workspaces.
Read more >Migrating a monorepo from Lerna to Yarn 3 with PnP and Zero ...
This command come from the workspace-tools plugin I've mentioned. It is using these options: v : verbose, prefix the output with the package ......
Read more >Yarn 3 typescript plugin not pulling in @types for package.json ...
One plugin yarn recommend for a typescript application is the typescript plugin. Installed via the command yarn plugin import typescript. This ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The reason this is happening is that we released Yarn 3.0 and the 3.0 plugins aren’t compatible with Yarn 2.0. We added support for specifying a version when importing plugins in 3.0 and made sure it imports compatible plugins when a version isn’t specified so this shouldn’t be an issue for future releases.
As a workaround you can run this to get the compatible version while staying on
yarn@2.4.1When you run that with v1 it grabs the latest v1 version, run this instead:
but you shouldn’t be running these commands on your CI and/or in Docker builds, you should run it locally once and commit it to your repository.
The time the plugin broke seems to match the release of plugin version 3.0.0.
Workarounds
Following are two workarounds, pick the one that is more suitable for your usecase.
Upgrade yarn: Upgrading Yarn to 3.0.0 by running
yarn set version latestallows you to use the 3.0.0 version installed withyarn plugin import workspace-tools.Don’t run
yarn plugin import workspace-toolsin your project anymore: I noticed this issue as well when my Docker builds started breaking over the night. I assume you are not supposed to import plugins again in the CI and instead just once when setting up your project. That’s probably somewhere in the docs but I didn’t search for it. As long as.yarn/pluginsand.yarnrc.ymlare copied into the container, the plugin should properly get referenced. I removed the plugin import from my Dockerfile and the build worked again, includingyarn workspaces focus.