Persistent Build Error:

Hello,

I’m encountering a persistent build error on my Next.js project and I’m completely stuck after trying all standard troubleshooting steps. I would be grateful for any help.

The Problem: Every deployment fails with the error: Build error occurred: > Couldn't find any 'pages' or 'app' directory.

What I’ve Confirmed:

What I’ve Already Tried:

  1. Root Directory: I’ve confirmed the “Root Directory” setting is empty, as the project is in the root. I also tried incorrectly setting it to a subfolder and then clearing it, which did not help.
  2. Manual Build Settings: I have manually overridden the build settings to explicitly use Next.js as the framework, next build as the build command, and npm install as the install command. The error persists.
  3. Re-importing: I have completely deleted the project from Vercel and re-imported it from GitHub multiple times. The fresh project fails with the exact same error immediately.
    “Couldn’t find any ‘pages’ or ‘app’ directory” Despite Correct Repo Structure
    Given that the repository structure is correct and all common configuration changes have failed, I suspect this might be an issue with the build container or caching on Vercel’s end for this specific repository.

Has anyone encountered a situation where the build environment consistently fails to see a valid project structure? Any advice on how to proceed would be greatly appreciated.

Thank you!

Hi,

Can you share the code repo?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.