Prisma 7 prisma.config.ts: 'Failed to load config file "/app" as a TypeScript/JavaScript module. Error: Cannot find module '.prisma/client/default'': import defineConfig from 'prisma/config'
Import the config helpers from the CLI package, not the client: import { defineConfig, env } from 'prisma/config'. In Prisma 7 this file is where the connection URL lives. Don't delete it to get past the error.
Working prisma.config.ts (Prisma 7.10.1):
import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
datasource: { url: env('DATABASE_URL') },
})import { defineConfig } from '@prisma/client' (seen in some guides) loads @prisma/client's default.js. That file requires the generated .prisma/client/default, which doesn't exist before the first prisma generate, so npx prisma generate dies with:
Failed to load config file "/app" as a TypeScript/JavaScript module. Error: Error: Cannot find module '.prisma/client/default' Require stack: - /app/node_modules/@prisma/client/default.js
It looks like a generate-order problem, but it's a wrong import. prisma/config exports exactly defineConfig and env.
Removing the config file only swaps errors. Without it, schema.prisma needs url = env(...), which Prisma 7 rejects with P1012. Reproduced both in node:22-slim: the wrong import fails, the right one prints Generated Prisma Client (7.10.1). With a prisma-client generator, a better-sqlite3 adapter client then creates rows.