Backstage "Cannot find module @backstage/plugin-..." in CI
Node could not resolve a @backstage/plugin-* package at build or runtime. Either the package is not in package.json, install skipped it, or it was imported without being added as a dependency.
What this error means
The build or backend start fails with "Error: Cannot find module '@backstage/plugin-catalog-backend'" and a stack that points into your app or backend index file.
node
Error: Cannot find module '@backstage/plugin-catalog-backend'
Require stack:
- /app/packages/backend/dist/index.cjs.js
at Function._resolveFilename (node:internal/modules/cjs/loader:...)Common causes
The plugin is imported but not a declared dependency
Code references the plugin, but it is missing from the workspace package.json, so it is never installed.
Install did not complete or the lockfile is out of date
A partial or cached install, or a yarn.lock that predates the added plugin, leaves the package absent from node_modules.
How to fix it
Add the plugin to the right workspace package
- Add the plugin dependency to the package that imports it (app or backend).
- Run install so the lockfile records it.
- Commit the updated yarn.lock and re-run CI.
Terminal
yarn --cwd packages/backend add @backstage/plugin-catalog-backendReinstall against a fresh lockfile
Ensure CI installs exactly what the lockfile pins so no plugin is silently missing.
Terminal
yarn install --immutableHow to prevent it
- Add every imported plugin as a dependency of the workspace that uses it.
- Commit yarn.lock so CI installs the full plugin set deterministically.
- Use
yarn install --immutablein CI to catch lockfile drift.
Related guides
Backstage "backstage-cli: command not found" in CIFix "backstage-cli: command not found" in CI - the @backstage/cli binary is missing because dependencies were…
Backstage yarn workspaces build fails in CIFix Backstage yarn workspaces build failures in CI - a workspace package fails to resolve internal packages o…
Backstage "yarn tsc" error TS type check fails in CIFix Backstage "yarn tsc" failing with "error TS..." in CI - the TypeScript type check finds errors that a loc…