{"record":{"id":"761a648432e7b5f0","repo":"mastra-ai/mastra","slug":"mastra-code-requires-corepack-to-install-github-pl","errorCode":null,"errorMessage":"Mastra Code requires Corepack to install GitHub plugin dependencies. Install it with \"npm install --global corepack\" and try again.","messagePattern":"Mastra Code requires Corepack to install GitHub plugin dependencies\\. Install it with \"npm install --global corepack\" and try again\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mastracode/sdk/src/plugins/dependencies.ts","lineNumber":49,"sourceCode":"  const pnpmVersion = getPnpmVersion(pluginRoot, packageManager);\n  const installCommand = getInstallCommand(pluginRoot, pnpmVersion);\n\n  const child = execa(installCommand.command, installCommand.args, {\n    cwd: pluginRoot,\n    env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },\n    stdout: options.onOutput ? 'pipe' : 'ignore',\n    stderr: options.onOutput ? 'pipe' : 'ignore',\n    cancelSignal: options.signal,\n  });\n  if (options.onOutput) {\n    child.stdout?.on('data', options.onOutput);\n    child.stderr?.on('data', options.onOutput);\n  }\n  try {\n    await child;\n  } catch (error) {\n    if (isCommandNotFoundError(error)) {\n      throw new Error(\n        'Mastra Code requires Corepack to install GitHub plugin dependencies. Install it with \"npm install --global corepack\" and try again.',\n        { cause: error },\n      );\n    }\n    throw error;\n  }\n  return true;\n}\n\nexport async function installPluginDependenciesForEntry(\n  pluginRoot: string,\n  entry: string,\n  options: PluginInstallExecutionOptions = {},\n): Promise<void> {\n  for (const dependencyRoot of getPluginDependencyRoots(pluginRoot, entry)) {\n    await installPluginDependencies(dependencyRoot, pluginRoot, options);\n  }\n}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/sdk/src/plugins/dependencies.ts#L31-L67","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (CI Dockerfile)\nFROM node:20-slim\nRUN npx mastra-code plugin install github:owner/repo\n\n// after\nFROM node:20-slim\nRUN npm install --global corepack && corepack enable\nRUN npx mastra-code plugin install github:owner/repo","handlingStrategy":"try-catch","validationCode":"import { execFileSync } from 'node:child_process';\nfunction isCorepackAvailable(): boolean {\n  try { execFileSync('corepack', ['--version'], { stdio: 'ignore' }); return true; }\n  catch { return false; }\n}\nif (!isCorepackAvailable()) throw new Error('Install corepack: npm install --global corepack');","typeGuard":null,"tryCatchPattern":"try {\n  await installPluginDependencies(...);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Corepack')) {\n    execSync('npm install --global corepack', { stdio: 'inherit' });\n    return installPluginDependencies(...); // retry once\n  }\n  throw err;\n}","preventionTips":["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."],"tags":["corepack","missing-binary","plugins","environment"],"backgroundTag":"command-not-found-corepack","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}