mastra-ai/mastra · error · MastraError
DEPLOYER_PNPM_IGNORED_BUILDS
DEPLOYER_PNPM_IGNORED_BUILDS
Error message
pnpm blocked build scripts for: ${ignoredPackages.join(', ')}. Add these packages to allowBuilds in pnpm-workspace.yaml and retry the build. What it means
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.
Source
Thrown at packages/deployer/src/services/deps.ts:373
});
try {
return await cpLogger({
cmd: `${pm} ${installCommand}`,
args,
env: process.env as Record<string, string>,
});
} catch (error) {
if (pm !== 'pnpm') throw error;
const processOutput =
error && typeof error === 'object'
? `${'stdout' in error ? String(error.stdout) : ''}\n${'stderr' in error ? String(error.stderr) : ''}`
: '';
const ignoredPackages = getPnpmIgnoredBuildPackages(processOutput);
if (ignoredPackages.length === 0) throw error;
throw new MastraError(
{
id: 'DEPLOYER_PNPM_IGNORED_BUILDS',
domain: ErrorDomain.DEPLOYER,
category: ErrorCategory.USER,
details: { packageNames: ignoredPackages.join(', ') },
text: `pnpm blocked build scripts for: ${ignoredPackages.join(', ')}. Add these packages to allowBuilds in pnpm-workspace.yaml and retry the build.`,
},
error,
);
}
}
public async installPackages(packages: string[]) {
const pm = this.packageManager;
const installCommand = this.getPackageManagerCommand(pm, 'add');
const env: Record<string, string> = {
PATH: process.env.PATH!,View on GitHub (pinned to 75dd419e61)
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.
Example fix
# pnpm-workspace.yaml — before packages: - . # after packages: - . allowBuilds: - sharp - esbuild
Defensive patterns
Strategy: validation
Validate before calling
const yaml = require('yaml');
const deps = Object.keys(require('./package.json').dependencies);
const nativeDeps = deps.filter(d => ['sharp', 'esbuild', 'bcrypt', 'sqlite3', 'canvas'].includes(d));
const ws = yaml.parse(require('fs').readFileSync('pnpm-workspace.yaml', 'utf8'));
const approved = new Set([...(ws.allowBuilds ?? []), ...(ws.onlyBuiltDependencies ?? [])]);
const missing = nativeDeps.filter(d => !approved.has(d));
if (missing.length) console.warn(`Add to allowBuilds before deploy: ${missing.join(', ')}`); Try / catch
try {
await deploy();
} catch (e) {
if (e?.id === 'DEPLOYER_PNPM_IGNORED_BUILDS') {
console.error(`Approve these packages in pnpm-workspace.yaml allowBuilds, then retry: ${e.details?.packageNames}`);
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Plugin at ${pluginRoot} must declare an exact pnpm version i
- DEPLOYER_INVALID_PNPM_BUILD_APPROVAL_CONFIG
- AcpAgent does not support resuming suspended generate calls
- ACP prompt stopped before completing: ${response.stopReason}
- Auth0 domain and audience are required, please provide them
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/c7002e0e72b3eed7.
Report an issue: GitHub.