keystonejs / keystone

The most powerful headless CMS for Node.js — built with GraphQL and React
https://keystonejs.com
MIT License
8.98k stars 1.13k forks source link

Build Keystone inside turborepo fails #9069

Open DrBoria opened 3 months ago

DrBoria commented 3 months ago

`// 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.

stuible commented 3 months ago

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

MinskLeo commented 3 months ago

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

borisno2 commented 3 months ago

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

stuible commented 3 months ago

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

DrBoria commented 2 weeks ago

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