mastra-ai/mastra · error
Mastra Code requires Corepack to install GitHub plugin depen
Error message
Mastra Code requires Corepack to install GitHub plugin dependencies. Install it with "npm install --global corepack" and try again.
What it means
Installing GitHub plugin dependencies requires Corepack, which provides the pinned pnpm/npm versions used to run installs. The install child process failed and `isCommandNotFoundError` determined the failure was because the corepack binary was not found on PATH. The SDK aborts with this actionable message instead of a raw spawn error.
Source
Thrown at mastracode/sdk/src/plugins/dependencies.ts:49
const pnpmVersion = getPnpmVersion(pluginRoot, packageManager);
const installCommand = getInstallCommand(pluginRoot, pnpmVersion);
const child = execa(installCommand.command, installCommand.args, {
cwd: pluginRoot,
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
stdout: options.onOutput ? 'pipe' : 'ignore',
stderr: options.onOutput ? 'pipe' : 'ignore',
cancelSignal: options.signal,
});
if (options.onOutput) {
child.stdout?.on('data', options.onOutput);
child.stderr?.on('data', options.onOutput);
}
try {
await child;
} catch (error) {
if (isCommandNotFoundError(error)) {
throw new Error(
'Mastra Code requires Corepack to install GitHub plugin dependencies. Install it with "npm install --global corepack" and try again.',
{ cause: error },
);
}
throw error;
}
return true;
}
export async function installPluginDependenciesForEntry(
pluginRoot: string,
entry: string,
options: PluginInstallExecutionOptions = {},
): Promise<void> {
for (const dependencyRoot of getPluginDependencyRoots(pluginRoot, entry)) {
await installPluginDependencies(dependencyRoot, pluginRoot, options);
}
}View on GitHub (pinned to 75dd419e61)
Solutions
- Run `npm install --global corepack` (or `corepack enable` if already bundled) and retry.
- Verify `corepack --version` resolves on PATH; fix PATH if the Node installation's bin dir is missing.
- Ensure your Node.js version is recent enough to ship/allow corepack; upgrade Node if needed.
- If the error is not actually corepack-related, re-run to see the underlying `cause` error.
Example fix
// before (CI Dockerfile) FROM node:20-slim RUN npx mastra-code plugin install github:owner/repo // after FROM node:20-slim RUN npm install --global corepack && corepack enable RUN npx mastra-code plugin install github:owner/repo
Defensive patterns
Strategy: try-catch
Validate before calling
import { execFileSync } from 'node:child_process';
function isCorepackAvailable(): boolean {
try { execFileSync('corepack', ['--version'], { stdio: 'ignore' }); return true; }
catch { return false; }
}
if (!isCorepackAvailable()) throw new Error('Install corepack: npm install --global corepack'); Try / catch
try {
await installPluginDependencies(...);
} catch (err) {
if (err instanceof Error && err.message.includes('Corepack')) {
execSync('npm install --global corepack', { stdio: 'inherit' });
return installPluginDependencies(...); // retry once
}
throw err;
} Prevention
- Run `corepack enable` during environment/CI bootstrap (Dockerfile, setup steps).
- Pin Node versions that bundle corepack and document it in the README.
- Smoke-test plugin installation in a fresh container as part of CI.
When it happens
Trigger: Calling install/installPluginDependenciesForEntry (via installPluginDependencies in mastracode/sdk/src/plugins/dependencies.ts) when the spawned package-manager child process exits and the error is classified as ENOENT/command-not-found.
Common situations: Fresh CI containers or minimal Docker images without Node's corepack; users on Node versions where corepack is not bundled or was removed; a PATH that excludes the Node bin directory.
Related errors
- GitHub CLI is required to install GitHub plugins. Install gh
- GitHub CLI is not authenticated. Run gh auth login, then ins
- @mastra/livekit: no fetch implementation available; pass `fe
- Parallel API key is required. Pass { apiKey } or set the PAR
- Perplexity API key is required. Pass { apiKey } or set the P
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/761a648432e7b5f0.
Report an issue: GitHub.