{"record":{"id":"c7002e0e72b3eed7","repo":"mastra-ai/mastra","slug":"deployer-pnpm-ignored-builds","errorCode":"DEPLOYER_PNPM_IGNORED_BUILDS","errorMessage":"pnpm blocked build scripts for: ${ignoredPackages.join(', ')}. Add these packages to allowBuilds in pnpm-workspace.yaml and retry the build.","messagePattern":"pnpm blocked build scripts for: (.+?)\\. Add these packages to allowBuilds in pnpm-workspace\\.yaml and retry the build\\.","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/deployer/src/services/deps.ts","lineNumber":373,"sourceCode":"    });\n\n    try {\n      return await cpLogger({\n        cmd: `${pm} ${installCommand}`,\n        args,\n        env: process.env as Record<string, string>,\n      });\n    } catch (error) {\n      if (pm !== 'pnpm') throw error;\n\n      const processOutput =\n        error && typeof error === 'object'\n          ? `${'stdout' in error ? String(error.stdout) : ''}\\n${'stderr' in error ? String(error.stderr) : ''}`\n          : '';\n      const ignoredPackages = getPnpmIgnoredBuildPackages(processOutput);\n      if (ignoredPackages.length === 0) throw error;\n\n      throw new MastraError(\n        {\n          id: 'DEPLOYER_PNPM_IGNORED_BUILDS',\n          domain: ErrorDomain.DEPLOYER,\n          category: ErrorCategory.USER,\n          details: { packageNames: ignoredPackages.join(', ') },\n          text: `pnpm blocked build scripts for: ${ignoredPackages.join(', ')}. Add these packages to allowBuilds in pnpm-workspace.yaml and retry the build.`,\n        },\n        error,\n      );\n    }\n  }\n\n  public async installPackages(packages: string[]) {\n    const pm = this.packageManager;\n    const installCommand = this.getPackageManagerCommand(pm, 'add');\n\n    const env: Record<string, string> = {\n      PATH: process.env.PATH!,","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/deployer/src/services/deps.ts#L355-L391","documentation":"During dependency install, if pnpm fails because it blocked lifecycle build scripts, the deployer scans the combined stdout/stderr with getPnpmIgnoredBuildPackages and, when ignored packages are found, throws DEPLOYER_PNPM_IGNORED_BUILDS naming them. It instructs you to approve those packages via allowBuilds in pnpm-workspace.yaml and retry. If no ignored packages are detected, the original install error is re-thrown instead.","triggerScenarios":"pnpm install/build during deploy blocks postinstall scripts of dependencies (pnpm >=10 default behavior) — e.g. sharp, esbuild, bcrypt — causing the install step to fail, detected via pnpm output listing ignored build packages.","commonSituations":"Upgrading to pnpm 10 where onlyBuiltDependencies/allowBuilds must now explicitly approve native-dependency build scripts; CI caches missing approved builds; newly added native packages not yet approved.","solutions":["Add the named packages to allowBuilds (or onlyBuiltDependencies) in pnpm-workspace.yaml and rebuild/deploy again.","Run `pnpm approve-builds` locally to interactively approve and persist the list.","Ensure the CI/deploy environment uses the same pnpm-workspace.yaml so approvals apply there too."],"exampleFix":"# pnpm-workspace.yaml — before\npackages:\n  - .\n# after\npackages:\n  - .\nallowBuilds:\n  - sharp\n  - esbuild","handlingStrategy":"validation","validationCode":"const yaml = require('yaml');\nconst deps = Object.keys(require('./package.json').dependencies);\nconst nativeDeps = deps.filter(d => ['sharp', 'esbuild', 'bcrypt', 'sqlite3', 'canvas'].includes(d));\nconst ws = yaml.parse(require('fs').readFileSync('pnpm-workspace.yaml', 'utf8'));\nconst approved = new Set([...(ws.allowBuilds ?? []), ...(ws.onlyBuiltDependencies ?? [])]);\nconst missing = nativeDeps.filter(d => !approved.has(d));\nif (missing.length) console.warn(`Add to allowBuilds before deploy: ${missing.join(', ')}`);","typeGuard":null,"tryCatchPattern":"try {\n  await deploy();\n} catch (e) {\n  if (e?.id === 'DEPLOYER_PNPM_IGNORED_BUILDS') {\n    console.error(`Approve these packages in pnpm-workspace.yaml allowBuilds, then retry: ${e.details?.packageNames}`);\n  }\n  throw e;\n}","preventionTips":["Run `pnpm approve-builds` after adding native dependencies (sharp, esbuild, etc.)","Keep the same pnpm-workspace.yaml approvals in CI and deploy images","Remember pnpm 10 blocks build scripts by default — approve them explicitly"],"tags":["pnpm","build-scripts","configuration","install"],"backgroundTag":"pnpm-ignored-build-scripts","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}