Postinstall hook fails with custom location for schema.prisma
See original GitHub issueBug description
When you have schema.prisma
at a non-default location, like db/schema.prisma
, then running npm install
results in a scary error message that confuses users.
> @prisma/client@2.1.3 postinstall /private/tmp/a1/node_modules/@prisma/client
> node scripts/postinstall.js
Error: Either provide --schema or make sure that you are in a folder with a schema.prisma file.
How to reproduce
- Move
schema.prisma
to non-default location - Delete
node_modules
- Run
npm i
- See error
Expected behavior
I’m not sure the best solution here, but at the very least this error message should be downgraded to info or warning and remove the terminal colors (currently bright red).
In Blitz we automatically generate prisma client as part of blitz build
or blitz start
, so usually Blitz users never have to think about this.
Environment & setup
@prisma/cli : 2.1.3
Current platform : darwin
Node: 12.6.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Generating the client (Concepts) - Prisma
This hook invokes the prisma generate command which in turn generates the Prisma Client code into the default location node_modules/. prisma/client .
Read more >How To Build a GraphQL API with Prisma and Deploy to ...
In this tutorial, you'll build a GraphQL API for a blogging application in JavaScript using Node.js. You will first use Apollo Server to ......
Read more >Command Line - Keystone 6 Documentation - KeystoneJS
The postinstall command will warn you if any of the generated files you should have committed to source control (such as the Prisma...
Read more >prisma/client did not initialize yet. Please run "prisma generate ...
I usually don't use docker for this while developing, but I have this issue every time I change something in my schema.prisma and...
Read more >Command Line Interface | RedwoodJS Docs
install, Appends DataMigration model to schema.prisma , creates api/db/dataMigrations directory. up, Executes outstanding data migrations ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am marking this as an improvement for now as behavior is confirmed but it is not breaking.
Thanks for reporting @flybayer! It for sure makes sense to not error in the postinstall script, but only when executing
prisma generate
directly.For all the cases that a schema could not be found, we now have this warning:
If the schema was invalid or any other error caused the generation to fail, we have this info: