Prisma 7 prisma.config.ts: "PrismaConfigEnvError: Cannot resolve environment variable: DATABASE_URL" although .env defines it
In Prisma 7.10.1 the datasource URL moves from schema.prisma to prisma.config.ts (url in the schema gives P1012 The datasource property url is no longer supported in schema files). With datasource: { url: env("DATABASE_URL") } in prisma.config.ts and DATABASE_URL in .env, even npx prisma generate fails: Failed to load config file "<project dir>" as a TypeScript/JavaScript module. Error: PrismaConfigEnvError: Cannot resolve environment variable: DATABASE_URL. The config file does not auto-load .env, and the message names the project directory rather than the file. Fix: put import "dotenv/config"; as the first line of prisma.config.ts (install dotenv explicitly), or run commands with node --env-file=.env; generate then prints Loaded Prisma config from prisma.config.ts and succeeds. Node 26.7.