Repository navigation
Description
Package and version
[email protected] (orm init installs [email protected] and @prisma/[email protected])
What happened?
npx prisma@latest orm init --yes --target postgres --authoring psl does not complete in a pnpm 11 or pnpm 12 workspace. Two separate failures, in order:
1. pnpm 11 and 12 refuse to install packages with unapproved build scripts, and orm init treats that as a failed install.
orm init runs pnpm add @prisma/orm-postgres dotenv and then pnpm add -D prisma@next @types/node. pnpm exits 1 on each:
ERR_PNPM_IGNORED_BUILDS Ignored build scripts: [email protected]
help: Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.
and on the dev-dependency step Ignored build scripts: [email protected], [email protected]. orm init then stops:
✘ [CLI.INIT_INSTALL_FAILED] Failed to install dependencies
why: pnpm exited with code 1.
It skips the remaining installs and the contract emit, leaving package.json half-populated even though the packages were actually added. pnpm 11 ignores the older onlyBuiltDependencies key; allowBuilds: { esbuild: true, msgpackr-extract: true, workerd: true } or strictDepBuilds: false in pnpm-workspace.yaml is needed before orm init will run.
2. Under pnpm 12, after the install steps succeed, the emit step fails because the @prisma/cli-engine link is dangling.
✘ [CLI.INIT_EMIT_FAILED] Failed to emit contract
Every later command in the package then fails too. With the package's own CLI:
CLI.CONFIG_UNREADABLE ... prisma.config.ts could not be evaluated: No "exports" main defined in .../node_modules/.pnpm/[email protected]_.../node_modules/@prisma/cli-engine/package.json
and with npx prisma@latest:
CLI.CONFIG_UNREADABLE ... prisma.config.ts could not be evaluated: Cannot find module '@prisma/cli-engine'
packages/database/node_modules/@prisma/cli-engine points at a directory that does not exist. The lockfile importer says version: 0.2.3 while the only materialized snapshot is 0.2.3([email protected]). pnpm install --force does not repair it. pnpm add -D prisma@latest @prisma/cli-engine@latest (rc.13 + 0.3.0) does. This reproduced twice from a clean workspace.
Inside orm init, the emit failure is reported with a misleading cause: why: prisma contract emit failed: prisma contract emit exited with code 2: Prisma agent skills are out of date ..., which hides the real CONFIG_UNREADABLE error.
What did you expect to happen?
orm init completes in a pnpm workspace like it does under npm, yarn, and Bun. Concretely:
- Run the installs with
--config.strict-dep-builds=false, writeallowBuildsfor the three packages, treatERR_PNPM_IGNORED_BUILDSas a warning, or drop the install-script dependencies from the CLI's tree. - Install
prisma,@prisma/cli-engine, and the runtime in onepnpm addcall (or install thecli-engineversion the runtime peer-depends on) so pnpm does not leave a dangling link. - Report the underlying
CONFIG_UNREADABLEerror rather than the skills reminder when emit fails.
Minimal reproduction
pnpm --versionreports 11.25.0 or 12.3.4.mkdir -p my-monorepo/packages/database && cd my-monorepo && pnpm init, addpackages: ["packages/*"]topnpm-workspace.yaml, thencd packages/database && pnpm init.npx prisma@latest orm init --yes --target postgres --authoring psl.- On pnpm 11:
CLI.INIT_INSTALL_FAILEDafterERR_PNPM_IGNORED_BUILDS. Add theallowBuildsblock above topnpm-workspace.yamland re-run. - On pnpm 12:
CLI.INIT_EMIT_FAILED, thenls -la node_modules/@prisma/cli-engineshows a link to a missing directory andpnpm prisma contract emitfails withCLI.CONFIG_UNREADABLE.
Environment
- OS: macOS 15
- Node.js: v24.11.1
- pnpm: 11.25.0 and 12.3.4
- Database: PostgreSQL 17 (local)
Additional context
Found while validating the Prisma 8 pnpm workspaces and Turborepo guides on 2026-09-10. Both guides now ask the reader to add allowBuilds before running orm init and to run pnpm add -D prisma@latest @prisma/cli-engine@latest afterwards. Related: pnpm dlx prisma@latest hangs on the ? Choose which packages to build prompt in non-interactive runs for the same reason.
Activity
fix(cli): fallback to npm on pnpm ERR_PNPM_IGNORED_BUILDS
wmadden-electric commentedon Sep 27, 2026
New facts on the second failure (the missing
@prisma/cli-enginelink), found while testing the pnpm workspaces guide withprisma8.0.0-rc.17,@prisma/orm-postgres8.0.0-rc.12, and@prisma/cli-engine0.6.1.It is a pnpm defect, and pnpm has fixed it. The matching reports are pnpm/pnpm#14714 and pnpm/pnpm#14764. The fix is pnpm/pnpm#14743, released in pnpm 12.4.1.
Tested in a clean
node:24container, from an empty directory:orm initCLI.INIT_EMIT_FAILEDCause. After
pnpm add -D @prisma/[email protected], the affected versions write the lockfile entry without its peer suffix (version: 0.6.1) and link the package tonode_modules/.pnpm/@[email protected]/..., which does not exist. Only the peer-suffixed copies exist, installed earlier as dependencies ofprismaand@prisma/orm-postgres.Repair.
pnpm dedupe, thenpnpm prisma contract emit.orm initdoes not need to run again, because it wrote all its files before the emit.pnpm install,pnpm install --force, andpnpm add -D prisma@latest @prisma/cli-engine@latestdo not repair it.What the CLI could still do.
orm initadds@prisma/cli-enginein a third install step, afterprisma(packages/1-framework/3-tooling/cli/src/orm/init.ts). For readers on pnpm 12.0 to 12.4.0, it could runpnpm dedupewhen the emit fails with a missing@prisma/cli-engine, or name that repair in the error's fix text.The docs change is in prisma/web#8326.
wmadden-electric commentedon Nov 17, 2026
We went through the three problems reported here and are closing this, because none of them leaves a change for
orm init.1. pnpm 11 and 12 fail the install on unapproved build scripts. This is pnpm working as designed.
orm initwill not switch that check off, approve build scripts for you, or treat the failure as a warning. It cannot know whether a skipped script was needed, and that decision belongs to the project's owner. Until the dependencies are gone, runpnpm approve-builds, or addallowBuildstopnpm-workspace.yaml, and runorm initagain.The real fix is the fourth option in the report: stop shipping dependencies that have install scripts.
esbuildis a dependency of@prisma/orm-toolchainand is being replaced.workerdandmsgpackr-extractarrive through theprismapackage, so that part is work for the Prisma CLI.2. The
@prisma/cli-enginelink points at a missing folder under pnpm 12. This is a pnpm defect, fixed in pnpm 12.4.1. The details are in the comment above. On pnpm 12.0 to 12.4.0, upgrade pnpm, or runpnpm dedupeand thenpnpm prisma contract emit.3. A failed emit showed the skills reminder and hid the real error. Fixed in #30291.