Skip to main content
Version: Next

Yarn Package Manager Module

The Yarn package manager module (@backstage/cli-module-package-manager-yarn) verifies that Yarn patch references, local patch files, and yarn.lock remain aligned. When a project patches a Backstage package, it also checks that the package version matches the Backstage release selected in backstage.json.

See Generating temporary patches for guidance on creating Yarn patches for locally modified Backstage packages.

The command verifies Yarn's native patch: protocol, available in Yarn 2 and later. It does not inspect patches managed by tools such as patch-package in Yarn Classic repositories.

pm verify-patches

Run this command from the root of a Yarn repository:

yarn backstage-cli pm verify-patches

The command scans the root and workspace package.json files for patch: references in resolutions, dependencies, devDependencies, optionalDependencies, and peerDependencies. It reports all of the following problems together before exiting unsuccessfully:

  • Missing or orphaned local patch files.
  • Patch references that do not agree with yarn.lock.
  • Patched @backstage/* packages that are missing from, or do not match, the selected Backstage release.

The command is read-only: it does not run Yarn, install dependencies, or write project files. Use it alongside yarn install --immutable; immutable installs protect the resolved dependency state, while this command verifies that patch declarations and the selected Backstage release remain aligned.

For offline or mirrored environments, set BACKSTAGE_MANIFEST_FILE to a local release manifest or BACKSTAGE_VERSIONS_BASE_URL to the base URL from which release manifests are fetched.