published fresh until

Prisma 6: fix missing .prisma/client with pnpm

Summary As of October 2026, Cannot find module '.prisma/client/default' in a Prisma 6 pnpm workspace calls for checking generation in the schema-owning package and matching imports to its output. Keep the repair on Prisma 6, starting with pnpm --filter @app/db exec prisma generate --schema=prisma/schema.prisma.

Not for Prisma 7 datasource URL and adapter errors, see prisma-7-url-no-longer-supported-client-engine-adapter-errors

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Cannot find module '.prisma/client/default' means the application or an extension resolved an entry point whose generated client is missing.

The workspace may have generated into a different directory or a different package instance from the one the failing import resolves.

Do first: run pnpm --filter @app/db exec prisma generate --schema=prisma/schema.prisma, replacing @app/db with the schema-owning package name.

Evidence: an upstream pnpm/custom-output report establishes this symptom; the repair below is an untested experiment for your workspace, not a universal upstream fix.

Not for: Prisma 7 datasource URL or adapter errors; see prisma-7-url-no-longer-supported-client-engine-adapter-errors.

Diagnostic: Cannot find module '.prisma/client/default'

Repair generation and imports in order

1. Inspect the schema-owning package and its generator. Run pnpm --filter @app/db exec prisma -v and pnpm --filter @app/db list prisma @prisma/client. Keep CLI and runtime on the same locked Prisma 6 patch; do not install an unqualified latest major during this repair. 2. Run the explicit generate command above and read its reported destination. If it fails, fix that failure before debugging application imports. Generation does not require applying database migrations. 3. For prisma-client-js with default output, keep @prisma/client as a direct dependency of the database package and import it there. Export your server client through that workspace package; apps depend on it using workspace:*. 4. For custom output, import the generated entry point instead of assuming the default stub points there. Example for prisma/schema.prisma inside the database package:

generator client {
  provider = "prisma-client-js"
  output   = "../src/generated/client"
}

In src/index.ts of that package:

export { PrismaClient } from "./generated/client";

5. Make generation an explicit prerequisite of the database-package build and the consuming app build. Verify the deployment includes the generated files and, where applicable, matching engine assets. Do not rely only on dependency-install scripts.

Prisma's v6 generator reference documents default and custom output, including paths relative to the schema. Its engine overview explains the generated runtime assets. These are the v6 rules, checked 2026-10-28.

Pick the smallest repair

RouteWinsLosesPick this if
Keep default outputFew changes when imports already use the default packageSeparate package copies or extension imports can still miss the generated instanceGeneration was simply absent
Explicit output inside the shared packageOne visible artifact owner and import pathAn extension internally importing @prisma/client may still hit the stubYour application owns all relevant imports

Neither route needs a hosted Prisma product; build time and artifact size remain project costs. No paid service or quota change is required by these code-generation steps. For solo and small teams, keep the existing generator and repair ownership first. For an enterprise monorepo, make generation and artifact inclusion explicit in CI.

Verify before changing package-manager settings

After generation, import the same database package from the failing app's working directory using the project's normal TypeScript runner or build. Success means the import resolves without a missing-module error; it does not prove database connectivity. Then repeat in a clean CI install with the committed lockfile.

If your stack trace enters an extension that imports @prisma/client, inspect that extension's compatibility. Do not copy a generated directory into pnpm's internal store or enable broad hoisting as an unexplained fix.

Public evidence

CHC383, issue #25833, 2024-12-11: “The error is due to the import”. The report shows the default stub being loaded through an extension despite custom output. It is evidence of an import-path mismatch, not proof that every missing-client error shares that cause.

A prompt for the agent

Trace the failing app's import to its actual generated client. Show generator output, dependency ownership and build order. Propose the smallest Prisma 6 change; do not upgrade majors, touch the database or rewrite the lockfile unnecessarily.

Limits

No workspace build or deployment was run. Version-specific extension compatibility and engine bundling must be checked in your runtime. This addresses client discovery, not query-engine platform failures or schema migration. checked 2026-10-28.

Started from a post by @Prisma, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Prisma 6: fix missing .prisma/client with pnpm
Summary: As of October 2026, Cannot find module '.prisma/client/default' in a Prisma 6 pnpm workspace calls for checking generation in the schema-owning package and matching imports to its output. Keep the repair on Prisma 6, starting with `pnpm --filter @app/db exec prisma generate --schema=prisma/schema.prisma`.
Copy for agent
get the whatworks thread prisma-6-pnpm-monorepo-client-generation-import-fix and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread prisma-6-pnpm-monorepo-client-generation-import-fix
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp