[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Help](/c/help/9)

# Error: The BUILD_ID file was not found in the Output Directory. Did you forget to run "next build" in your Build Command?

198 views · 4 likes · 4 posts


Info Westpalmtest (@info-westpalmtest) · 2024-07-18

<!-- Be sure to include all detail needed to let others see the same problem -->

Hey everyone :wave: 

Trying to deploy a Turborepo project to Vercel and while build is generated successfully, I'm getting error `Error: The BUILD_ID file was not found in the Output Directory. Did you forget to run "next build" in your Build Command? ` in the end of the build step and of course it doesn't deploy.

Locally tho, BUILD_ID is present inside `.next` directory and I can successfully run `npm run start` with Turborepo. 

Below is my `turbo.json` 

```
{
  "$schema": "https://turbo.build/schema.json",
  "globalEnv": [
    "NODE_ENV",
    "DATABASE_URL"
  ],
  "ui": "tui",
  "tasks": {
    "build": {
      "dependsOn": [
        "^build"
      ],
      "outputs": [
        ".next/**",
        "!.next/cache/**"
      ],
      "env": [
        "NEXT_PUBLIC_SUPABASE_ANON_KEY",
        "NEXT_PUBLIC_SUPABASE_URL",
        "NEXT_PUBLIC_STRIPE_KEY",
        "STRIPE_API_KEY",
        "NEXT_PRUBLIC_CART_CANCEL_URL",
        "NEXT_PUBLIC_CART_SUCCESS_URL",
        "TEACHWORKS_API_KEY",
        "UPSTASH_KAFKA_REST_PASSWORD",
        "UPSTASH_KAFKA_REST_URL",
        "UPSTASH_KAFKA_REST_USERNAME",
        "KAFKA_BROKER",
        "KAFKA_USERNAME",
        "KAFKA_PASSWORD",
        "MONGODB_URI",
        "RESEND_API_KEY",
        "SENTRY_AUTH_TOKEN",
        "CLERK_SECRET_KEY",
        "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
        "NEXTAUTH_SECRET",
        "WEBHOOK_SECRET",
        "NEXT_PUBLIC_BASE_URL",
        "DIRECT_URL"
      ]
    },
    "db:generate": {
      "cache": false
    },
    "db:migrate": {
      "cache": false
    },
    "db:push": {
      "cache": false
    },
    "ios": {
      "cache": false
    },
    "check-types": {
      "dependsOn": [
        "^check-types"
      ]
    },
    "dev": {
      "persistent": true,
      "dependsOn": [
        "^db:generate"
      ],
      "cache": false,
      "inputs": [
        ".env"
      ]
    }
  }
}
``` 

I'm pretty new to Turborepo setup, but this is the first time I see error like this with Vercel


Info Westpalmtest (@info-westpalmtest) · 2024-07-18

Also, running `vercel build` locally gave me the same error and the content of `.turbo/runs` is showing that there's BUILD_ID in the expandedOutputs

```"expandedOutputs": [
        "apps/next/.next",
        "apps/next/.next/BUILD_ID",
        "apps/next/.next/app-build-manifest.json",
        "apps/next/.next/app-path-routes-manifest.json",
        "apps/next/.next/build-manifest.json",
```


Anthony Shew (@anthony-shew) · 2024-07-19 · ♥ 3

This is likely because the [Root Directory](https://vercel.com/docs/deployments/configure-a-build#root-directory) is not set for the project in the monorepo, so the build outputs don't exist in the expected place.

Does setting the Root Directory help?


Info Westpalmtest (@info-westpalmtest) · 2024-07-19 · ♥ 1

Hey Anthony! Yes, you're right! Setting Root Directory to apps/{next_dir} helped and everything is working properly! 

Thanks!