keystone icon indicating copy to clipboard operation
keystone copied to clipboard

Build Keystone inside turborepo fails

Open DrBoria opened this issue 1 year ago • 5 comments

`// create turborepo npx create-turbo@latest my-monorepo cd my-monorepo

// add keystone to turborepo cd apps npm init keystone-app my-keystone-app

cd my-keystone-app npm run build`

As I expect it should build production-ready static pages. But I'm receiving error NEXT_EXPORT_ERROR image

If I move keystone outside of turborepo and install dependencies once again - it works fine. But inside - it fails.

Environment:

"@keystone-6/auth": "^7.0.2", "@keystone-6/core": "^5.7.2", "@keystone-6/fields-document": "^8.0.2", Node version 18.18.0

windows 11, macos, and vercel build - same errors.

DrBoria avatar Mar 27 '24 11:03 DrBoria

I also hit this error when I tried to move from Next 13 to Next 14 inside turborepo.

stuible avatar Mar 28 '24 18:03 stuible

Identical situation with upgrade from Next 13 to Next 14 in NX monorepo...

MinskLeo avatar Mar 29 '24 18:03 MinskLeo

There is potenitally multiple versions of NextJs in your dependency tree. You could try using overrides to force a particular version of NextJS - I am using Turbo with NextJS 14 without issues but using overrides https://github.com/borisno2/on-the-hill-drama-club/blob/main/package.json#L94

borisno2 avatar Apr 01 '24 07:04 borisno2

Good call @borisno2! I thought I had already ruled this out but tried again and was able to build without error.

stuible avatar Apr 03 '24 22:04 stuible

Previously used turborepo - didn't works even with overrides. As a result - solution is to set in the repository the same version of next as in keystone-6 So for 6.1.0 - "next": "13.3.0"

Works for me.

Same situation with Prisma: Error: Cannot find module '.prisma/client/default'

Just install prisma: 15.3.0

DrBoria avatar Jun 16 '24 20:06 DrBoria