Skip to content

orm init fails under pnpm 11 and 12: CLI.INIT_INSTALL_FAILED on ignored build scripts, then a dangling @prisma/cli-engine link #30254

Closed as not planned

Description

@ankur-arch

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, write allowBuilds for the three packages, treat ERR_PNPM_IGNORED_BUILDS as a warning, or drop the install-script dependencies from the CLI's tree.
  • Install prisma, @prisma/cli-engine, and the runtime in one pnpm add call (or install the cli-engine version the runtime peer-depends on) so pnpm does not leave a dangling link.
  • Report the underlying CONFIG_UNREADABLE error rather than the skills reminder when emit fails.

Minimal reproduction

  1. pnpm --version reports 11.25.0 or 12.3.4.
  2. mkdir -p my-monorepo/packages/database && cd my-monorepo && pnpm init, add packages: ["packages/*"] to pnpm-workspace.yaml, then cd packages/database && pnpm init.
  3. npx prisma@latest orm init --yes --target postgres --authoring psl.
  4. On pnpm 11: CLI.INIT_INSTALL_FAILED after ERR_PNPM_IGNORED_BUILDS. Add the allowBuilds block above to pnpm-workspace.yaml and re-run.
  5. On pnpm 12: CLI.INIT_EMIT_FAILED, then ls -la node_modules/@prisma/cli-engine shows a link to a missing directory and pnpm prisma contract emit fails with CLI.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

  1. added a commit that references this issue on Sep 15, 2026
    3803103
  2. wmadden-electric commented on Sep 27, 2026

    @wmadden-electric
    Contributor

    New facts on the second failure (the missing @prisma/cli-engine link), found while testing the pnpm workspaces guide with prisma 8.0.0-rc.17, @prisma/orm-postgres 8.0.0-rc.12, and @prisma/cli-engine 0.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:24 container, from an empty directory:

    pnpm orm init
    12.0.0 fails at "Emit the contract" with CLI.INIT_EMIT_FAILED
    12.3.4 fails the same way
    12.4.0 fails the same way
    12.4.1 passes
    12.7.0 passes
    11.25.0 passes

    Cause. 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 to node_modules/.pnpm/@[email protected]/..., which does not exist. Only the peer-suffixed copies exist, installed earlier as dependencies of prisma and @prisma/orm-postgres.

    Repair. pnpm dedupe, then pnpm prisma contract emit. orm init does not need to run again, because it wrote all its files before the emit. pnpm install, pnpm install --force, and pnpm add -D prisma@latest @prisma/cli-engine@latest do not repair it.

    What the CLI could still do. orm init adds @prisma/cli-engine in a third install step, after prisma (packages/1-framework/3-tooling/cli/src/orm/init.ts). For readers on pnpm 12.0 to 12.4.0, it could run pnpm dedupe when 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.

  3. wmadden-electric commented on Nov 17, 2026

    @wmadden-electric
    Contributor

    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 init will 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, run pnpm approve-builds, or add allowBuilds to pnpm-workspace.yaml, and run orm init again.

    The real fix is the fourth option in the report: stop shipping dependencies that have install scripts. esbuild is a dependency of @prisma/orm-toolchain and is being replaced. workerd and msgpackr-extract arrive through the prisma package, so that part is work for the Prisma CLI.

    2. The @prisma/cli-engine link 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 run pnpm dedupe and then pnpm prisma contract emit.

    3. A failed emit showed the skills reminder and hid the real error. Fixed in #30291.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions