[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"problem-detail-error-couldn-t-find-any-pages-or-app-directory":3},{"stack":4,"error":5,"seoName":6,"seoStack":7,"seo":8,"breadcrumb":10,"titlePrefix":17,"titleAccent":18,"lead":19,"facts":22,"why":37,"log":55,"fix":88,"engine":104,"related":115,"pitch":122},"nextjs","couldn-t-find-any-pages-or-app-directory","Next.js build fails because no pages or app directory is at the project root","Nextjs",{"description":9},"Learn what causes Next.js build fails because no pages or app directory is at the project root, how PanelAlpha Engine responds to it during deployment.",[11,14,16],{"label":12,"href":13},"App Installations","\u002Fapps",{"label":7,"href":15},"\u002Fapps\u002Fstacks\u002Fnextjs",{"label":6},"Next.js build fails because ","no pages or app directory is at the project root",[20],{"text":21},"Error recorded 1 times in PanelAlpha Engine deploys on Nextjs. The deploy log below is the recorded failure output.",[23,28,31,33],{"label":24,"value":25,"tone":26,"tooltip":27},"Type","Error","err","An error that occurred in the deployed application. It is not necessarily a PanelAlpha Engine error, but we keep working on improvements so you run into fewer of them.",{"label":29,"value":30},"Seen","1 times",{"label":32,"value":7},"Where",{"label":34,"value":35,"tooltip":36},"Status","Observed","Our team will look into this soon, verify the cause and try to fix it in an upcoming release.",{"heading":38,"body":39},"Why it happens",[40,42,45,47,49,51,53],{"text":41},"The Next.js strategy started from a project root that does not contain a ",{"text":43,"code":44},"pages",true,{"text":46}," or ",{"text":48,"code":44},"app",{"text":50}," directory. This commonly happens when the Next.js app is inside a subdirectory or when the repository is not a standard Next.js app. The deployment also fell back to installing Next.js with ",{"text":52,"code":44},"npm exec",{"text":54},", despite the project using pnpm.",{"heading":56,"block":57},"What the log looks like",{"header":58,"lines":59},"Deploy log",[60,64,68,72,76,80,84],{"segments":61},[62],{"text":63},"Done in 1m 38.3s",{"segments":65},[66],{"text":67},"cp: cannot stat '\u002Fapp\u002Fpackage-lock.json': No such file or directory",{"segments":69},[70],{"text":71},"npm warn exec The following package was not found and will be installed: next@16.3.5",{"segments":73},[74],{"text":75},"▲ Next.js 16.3.5 (Turbopack)",{"segments":77},[78],{"text":79},"> Build error occurred",{"segments":81},[82],{"text":83},"Error: > Couldn't find any `pages` or `app` directory. Please create one under the project root",{"segments":85},[86],{"text":87},"Deploy failed: Failed to start app",{"heading":89,"steps":90,"block":101},"How to fix it",[91],[92,94,96,97,99],{"text":93},"Confirm the intended Next.js app directory contains ",{"text":95,"code":44},"app\u002F",{"text":46},{"text":98,"code":44},"pages\u002F",{"text":100},", then set that directory as the deployment root or configure the monorepo workspace command. If this repository is not a Next.js app, select its actual strategy and start command. Keep the package manager consistent with the repository and commit the required lockfile.",{"header":102,"lines":103},"Fix by hand",[],{"heading":105,"body":106,"block":112},"How PanelAlpha Engine solves it",[107,109,110],{"text":108},"The detector should verify the selected root contains a Next.js entry directory before starting. For monorepos, it should identify the workspace containing the app and use its package-manager-specific build\u002Fstart commands instead of silently falling back to ",{"text":52,"code":44},{"text":111},".",{"header":113,"lines":114},"",[],{"heading":116,"items":117},"Apps affected",[118],{"title":119,"badge":120,"tone":26,"href":121},"zitadel","1 occurrence","\u002Fapps\u002Fzitadel\u002Fzitadel",{"heading":123,"body":124,"footNote":125,"docsLabel":126,"docsHref":127},"Try PanelAlpha Engine yourself.","The easiest way to turn your server into a safe, controlled environment for your AI agent. Deploy, manage and maintain any project from Claude Code, Cursor, Codex or any other MCP client. Open source under Apache 2.0, free to run.","Requires Ubuntu 24.04 or 26.04 · 2 GB RAM · 1 CPU","Read the documentation","https:\u002F\u002Fpanelalpha.com\u002Fdocs"]