GraphQL Code Generator "Unable to find Plugin" in CI
Each entry under plugins in codegen.yml maps to an npm package. If that package is not installed (missing from devDependencies, or npm ci did not run), the generator reports it cannot find the plugin and tells you to install it.
What this error means
graphql-codegen fails with "Unable to find Plugin \"typescript-operations\". Install the plugin via npm/yarn ..." and stops before generating.
Unable to find Plugin "typescript-operations". Install the plugin via npm/yarn:
npm install --save-dev @graphql-codegen/typescript-operationsCommon causes
The plugin package is not in dependencies
codegen.yml references a plugin whose @graphql-codegen/<name> package was never added, so a clean install does not provide it.
Dependencies were not installed before codegen ran
The job ran the generate step without a prior npm ci, so node_modules lacks the plugin.
How to fix it
Add the plugin and install dependencies
- Add the
@graphql-codegen/<name>package to devDependencies. - Run
npm ci(or your package manager equivalent) before codegen. - Re-run the generate step.
npm install --save-dev @graphql-codegen/typescript-operations
npm ci
npx graphql-codegenOrder CI steps so install precedes generation
Make sure the codegen step depends on a completed dependency install.
- run: npm ci
- run: npx graphql-codegen --config codegen.ymlHow to prevent it
- List every codegen plugin in devDependencies and commit the lockfile.
- Run
npm cibefore any codegen step. - Pin plugin versions so generated output is reproducible.