Assuming that you're using turbo
with pnpm
1. Verify your package names in package.json
files
Imagine you have a structure like this:
root/
├─ apps/
│ ├─ web/
├─ packages/
│ ├─ tsconfig/
And this is your pnpm-workspace.yaml
file:
packages:
- "apps/*"
- "packages/*"
Then you have to make sure that name
field in package.json
file in your web
project is representing web
as well, like so:
{
"name": "web",
"scripts": {
"dev": "next dev",
"build": "next build",
},
// ...
}
2. Double-check your root package.json
and turbo.json
files
A minimal root package.json
in a turborepo project:
{
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
},
"devDependencies": {
"turbo": "^1.8.3"
},
"packageManager": "[email protected]"
}
And the turbo.json
file at the root:
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**"]
},
"dev": {
"cache": false,
}
}
}
3. Check your build
and install
commands in Vercel UI
Go to Settings
-> General
tab in your project in Vercel UI and verify commands:
The build
command should be:
cd ../../ && pnpm run build --filter=web...
And install
command (assuming that you're using pnpm)
pnpm install
4. Check "Root Directory" in Vercel UI
Go to Settings
-> General
tab in your project in Vercel UI and verify the project path:
Verify that it's representing your next.js project path: apps\web