Next-server.js is not found during deployment

So I have a nextjs monorepo with pnpm and two separate next project in the apps folder (see the packet-details branch on this link). I’m building this locally then I deploy it to vercel using the CLI. At deployment I’m getting the following error in both projects:

Error: ENOENT: no such file or directory, lstat '/node_modules/next/dist/server/next-server.js'

I’m using the following stuff:

cli: 48.10.3
next: 16.0.0 (both projects)
pnpm: 10.15.1

What makes this interesting that when I check my deploymnet on vercel CLI, I do find the file in question.

Hey, @programmerpeter2! Welcome to the Vercel Community :waving_hand:

Can you make sure your vercel.json or project settings specify the correct build output directory for each app?

For monorepos, you might need:

{
  "buildCommand": "cd apps/your-app && pnpm build",
  "outputDirectory": "apps/your-app/.next"
}