Skip to content
Latchkey

Yarn Berry "yarn workspaces focus" missing plugin in CI

yarn workspaces focus installs only one workspace and its dependencies, which speeds up CI for a single package. It lives in the workspace-tools plugin; without that plugin, Yarn does not know the command.

What this error means

A CI step running yarn workspaces focus <pkg> fails with "Usage Error: Couldn't find the workspaces focus command" or an unknown-command error.

yarn
Usage Error: Couldn't find a script named "focus".

$ yarn workspaces focus @acme/api --production

Common causes

The workspace-tools plugin is not installed

workspaces focus is not built in; the @yarnpkg/plugin-workspace-tools plugin must be imported to add it.

The plugin was added locally but not committed

The plugin lives in .yarn/plugins and its reference in .yarnrc.yml; if not committed, CI lacks it.

How to fix it

Add and commit the workspace-tools plugin

  1. Run yarn plugin import workspace-tools.
  2. Commit .yarn/plugins and the updated .yarnrc.yml.
  3. CI can then run yarn workspaces focus.
Terminal
yarn plugin import workspace-tools
git add .yarn/plugins .yarnrc.yml

Focus a single workspace in CI

Once the plugin is present, install just the target workspace and its production deps to cut install time.

.github/workflows/ci.yml
- run: yarn workspaces focus @acme/api --production

How to prevent it

  • Commit .yarn/plugins and .yarnrc.yml so plugins are available in CI.
  • Import workspace-tools before relying on workspaces focus.
  • Use focus to install only what a job needs.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →