Multifile schema example not working https://github.com/prisma/dub

I cloned the example https://github.com/prisma/dub and tried running npx prisma generate and get the following error: You can either provide it with --schema argument, set it in your prisma.config.ts, set it as prisma.schema in your package.json, or put it into the default location (./prisma/schema.prisma, or ./schema.prisma. Checked following paths: schema.prisma: file not found prisma/schema.prisma: file not found See also https://pris.ly/d/prisma-schema-location
GitHub
GitHub - prisma/dub: Open-source link management infrastructure.
Open-source link management infrastructure. Contribute to prisma/dub development by creating an account on GitHub.
Prisma Schema Location and Configuration | Prisma Documentation
Documentation regarding proper location of Prisma Schema including default naming and multiple files.
2 Replies
Prisma AI Help
Skipping coffee for instant knowledge! Let's brew that AI answer now. The error you're seeing indicates that Prisma can't find your schema because, with a multi-file schema setup, you must explicitly tell Prisma where your schema folder is. By default, Prisma looks for a single file at ./prisma/schema.prisma or ./schema.prisma. In the dub example, the schema is split across multiple files, so you need to configure Prisma to look at the folder instead. How to fix: 1. Set the schema path in your package.json:
{
"prisma": {
"schema": "./prisma"
}
}

{
"prisma": {
"schema": "./prisma"
}
}

This tells Prisma to use the ./prisma directory, which contains your multi-file schema. Alternatively, you can use the --schema flag with CLI commands, e.g.:
npx prisma generate --schema=./prisma

npx prisma generate --schema=./prisma

2. Make sure your main schema file (with datasource and generator blocks) is inside the ./prisma folder. All other .prisma files (with models, etc.) should also be in this folder or subfolders. 3. If you use migrations, the migrations directory must be at the same level as the main schema file (the one with the datasource block). This approach is required for multi-file schemas as of Prisma v6.7.0 and later. If you follow these steps, Prisma CLI commands like generate, migrate, and studio will work as expected with the dub example or any multi-file schema setup. For more details, see the official docs: Schema location and Common patterns. If you still get the error after this, double-check that your main schema file is present and correctly named, and that your package.json or CLI command points to the correct folder.
Nurul
Nurul2w ago
Are you using the same prisma version from dub example?

Did you find this page helpful?