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:
- My GitHub repository (
mcollis56/small-ai-website) has the correct structure, with theappdirectory,package.json, and other config files in the root. There is no subdirectory. - Here is a link to one of the failed deployments for full logs: small-ai-website-5ap129agd-marks-projects-ce888d78.vercel.app
What I’ve Already Tried:
- 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.
- Manual Build Settings: I have manually overridden the build settings to explicitly use
Next.jsas the framework,next buildas the build command, andnpm installas the install command. The error persists. - 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!