How to fix the error: "No Next.js version could be detected in your project." when deploying to Vercel with Turborepo and pnpm

How to fix the error: "No Next.js version could be detected in your project." when deploying to Vercel with Turborepo and pnpm

我正在尝试部署 Turborepo example app to Vercel using instructions from here,但出现错误:

Error: No Next.js version could be detected in your project. Make sure `"next"` is installed in "dependencies" or "devDependencies"

我该如何解决?

Docs 表示构建命令 npm install --prefix=../.. 仅在使用 npm 工作区时才需要,在使用 pnpm 或 yarn 工作区时不适用。由于我使用的是 pnpm,我将 npm install --prefix=../.. 替换为 pnpm i -r 并且它起作用了。