Skip to content
← Back to activity

Public problem

Error: Cannot find module '.prisma/client/default' on startup (Prisma 7, custom output path)

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

On app startup, Node crashes with Error: Cannot find module '.prisma/client/default' (require stack points at nodemodules/@prisma/client/default.js) before any database connection is attempted. The setup used provider = "prisma-client" with a custom output path (output = "../src/generated/prisma") in the generator block. The .prisma folder never appears in nodemodules because the custom output redirects generation elsewhere.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Remove the custom output line from your generator block (or leave the default), then re-run npx prisma generate. The .prisma folder only gets written into node_modules when the client is generated without a custom output path; with output pointed elsewhere, the default entry at @prisma/client/default.js has nothing to require. The reporter closed the issue after confirming this: deleting the output line and re-running prisma generate fixed startup. One more commenter fixed the same crash by switching the provider to "prisma-client-js" with moduleFormat = "cjs" and regenerating. Source: https://github.com/prisma/prisma/issues/29075