Skip to content

Error: Cannot find module '.prisma/client/default' #29075

Description

@Harlloh

Bug description

I’m encountering the following error when trying to use Prisma with PostgreSQL in an Express app:
`Error: Cannot find module '.prisma/client/default'
Require stack:

  • node_modules/@prisma/client/default.js
    `

This happens immediately on app startup, before any database connection attempt.

Environment:

  • OS: Windows 10
  • Node.js: v22.17.1
  • Prisma CLI: latest
  • @prisma/client: latest
  • Database: PostgreSQL
  • Runtime: Express (ModuleJS)

Severity

⚠️ Major: Breaks core functionality (e.g., migrations fail)

Reproduction

Steps to Reproduce

  1. Initialize Prisma
  2. Install Prisma Client
  3. Configure Prisma with @prisma/adapter-pg
  4. Set a custom Prisma Client output path
  5. Import PrismaClient from @prisma/client

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

datasource db {
provider = "postgresql"
}

Prisma Client initialization
import { PrismaPg } from '@prisma/adapter-pg';
import pg from 'pg';
import pkg from '@prisma/client';

const { PrismaClient } = pkg;

const pool = new pg.Pool({
connectionString: process.env.DATABASE_URL,
});

const adapter = new PrismaPg(pool);

const prisma = new PrismaClient({
adapter,
});

Expected vs. Actual Behavior

Expected behavior

Prisma Client should load successfully and connect to PostgreSQL.

Actual behavior
Node crashes with:
Error: Cannot find module '.prisma/client/default'

Frequency

Consistently reproducible

Does this occur in development or production?

Only in development (e.g., CLI tools, migrations, Prisma Studio)

Is this a regression?

Workaround

Prisma Schema & Queries

// Add relevant schema.prisma snippet
// Add relevant Prisma Client query

Prisma Config

// Add your `prisma.config.ts`

Logs & Debug Info

// Debug logs here

Environment & Setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version

// Prisma version output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions