#Turborepo with prisma build and dev errors

3 messages · Page 1 of 1 (latest)

slim pythonBOT
#

You selected the bot's instantaneous insights. Let me compile your answer right away!

slim pythonBOT
# slim python You selected the bot's instantaneous insights. Let me compile your answer right ...

This looks related to using Prisma + Turborepo + pnpm together, not specifically a Windows-only issue. From the logs, two tasks fail:

  • @repo/db#db:generate (runs prisma generate)
  • docs#build (likely depends on db:generate via turbo.json)

Because db:generate fails, web and docs never complete. The guide explicitly warns that dev/build must depend on db:generate so Prisma Client is generated first. [Configure tasks]

First, confirm your setup matches the guide:

  1. Database package scripts

packages/database/package.json should look like:

{
  "name": "@repo/db",
  "version": "0.0.0",
  "scripts": {
    "db:generate": "prisma generate",
    "db:migrate": "prisma migrate dev --skip-generate",
    "db:deploy": "prisma migrate deploy"
  },
  "devDependencies": {
    "prisma": "^6.6.0"
  },
  "dependencies": {
    "@prisma/client": "^6.6.0"
  }
}

[DB scripts]

  1. Turbo task config

Root turbo.json should ensure build/dev depend on ^db:generate:

{
  "$schema": "<https://turbo.build/schema.json",>
  "tasks": {
    "build": {
      "dependsOn": ["^build", "^db:generate"],
      "inputs": ["$TURBO_DEFAULT$", ".env*"],
      "outputs": [".next/**", "!.next/cache/**"],
      "env": ["DATABASE_URL"]
    },
    "dev": {
      "dependsOn": ["^db:generate"],
      "cache": false,
      "persistent": true
    },
    "db:generate": { "cache": false },
    "db:migrate": { "cache": false, "persistent": true },
    "db:deploy": { "cache": false }
  }
}

[Configure tasks]

  1. Run db:generate directly to see the real error

From the repo root:

pnpm turbo run db:generate --filter=@repo/db --no-cache

or inside packages/database:

slim pythonBOT
# slim python You selected the bot's instantaneous insights. Let me compile your answer right ...

cd packages/database
pnpm run db:generate


This should print the actual Prisma error (schema issue, env var, etc.). The knowledge sources don’t include your exact error message, so I can’t say precisely why `prisma generate` exits, only that this is the failing step.

4. **Environment variables**

Ensure `DATABASE_URL` is available where `db:generate` runs (either `.env` in `packages/database` or via Turbo `env` / `globalEnv`). [[DB scripts](<https://www.prisma.io/docs/guides/turborepo#23-add-scripts-and-run-migrations>)]

5. **Docs/web env**

For apps like `web`, you also need a `.env` with the same `DATABASE_URL` (or a shared env solution) as shown in the guide. [[Import db in web](<https://www.prisma.io/docs/guides/turborepo#3-import-the-database-package-in-the-web-app>)]

If you can share the output of `pnpm run db:generate` from `packages/database`, I can help interpret it, but the knowledge sources don’t provide more Windows-specific guidance beyond this.