keystone: Postinstall hook throws Prisma error when using pnpm: Command failed with exit code 1: npm install -D prisma@latest

  • Use pnpm for dependency management.
  • Run keystone postinstall

Expected behaviour: Postinstall completes

Actual: Error thrown when trying to install Prisma, see below screenshot (it’s for postinstall --fix but the same thing happens with postinstall): image

This seems like it’s probably an issue with the dependency file structure of pnpm. No such error happens with npm, or when forcing a flat node_modules structure by using pnpm i --shamefully-hoist.

It’s not clear to me whether this is an issue on the Prisma side or on the Keystone side. Please let me know if it needs to be reported elsewhere.

Node version 18.3

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 17 (11 by maintainers)

Most upvoted comments

To be more specific I had to list:

  • react
  • @babel/runtime
  • @prisma/client
  • prisma
  • @types/react
  • @types/node

That at least makes all keystone commands succeed and the GraphQL API works as expected. BUT when trying to access the keystone admin UI I am stuck with the error:

Error: Cannot find module 'next/dist/shared/lib/constants.js'
Require stack:
- C:\Users\fkrauthan\WebstormProjects\xxx\backend\.keystone\admin\.next\server\pages\_document.js

Hi @isla-nye Thanks for posting, we are exploring how we might better support pnpm for package management, currently you can list prisma and @prisma/client in your dependencies OR as you suggest use pnpm i --shamefully-hoist. Thanks