Next.js build fails because no pages or app directory is at the project root
Error recorded 2 times in PanelAlpha Engine deploys on Nextjs. The deploy log below is the recorded failure output.
TypeErrorAn 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.
Seen2 times · 2 variants
WhereNextjs
StatusObserved (2.1.0)Our team will look into this soon, verify the cause and try to fix it in an upcoming release.
Why it happens
The Next.js strategy started from a project root that does not contain a pages or app 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 npm exec, despite the project using pnpm.
What the log looks like
Deploy log
Done in 1m 38.3scp: cannot stat '/app/package-lock.json': No such file or directorynpm warn exec The following package was not found and will be installed: [email protected]▲ Next.js 16.3.5 (Turbopack)> Build error occurredError: > Couldn't find any `pages` or `app` directory. Please create one under the project rootDeploy failed: Failed to start app