Error occurred prerendering page "/_not-found"

hi, I am hitting a vercel deploy issue:Error occurred prerendering page “/_not-found”

The app works locally. ( app router “next”: “15.1.3”)
example : http://localhost:3000/_not-found

My vercel build command : npx convex deploy --cmd 'npm run build'

this is my folder layout:

vercel.json
Client/next.config.ts
Client/package.json
client/src/App/layout.tsx
client/src/App/page.tsx
client/src/App/not-found.tsx

====================================
this is my vercel.json

{
    "outputDirectory": ".next/standalone",
    "builds": [
      {
        "src": "client/package.json",  "use": "@vercel/next"

      },
      {
        "src": "server/server.py",  "use": "@vercel/python"

      }
    ],
    "routes": [
      {
        "src": "/(.*)",
        "dest": "client/$1"
      },
      {
        "src": "/(.*)", "dest": "server/server.py"
      }
    ]    
}

====================================
This is my next.config.ts

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  
};

export default nextConfig;

===========================
This is my package.json

{
  "name": "zork0",
  "version": "0.1.0",
  "private": true,
  "license": "MIT" ,
  "description": "The Zork0 digital entity. The final outcome of all worlds." ,
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@clerk/clerk-react": "^5.22.3",
    "@clerk/nextjs": "^6.9.6",
    "@types/styled-components": "^5.1.34",
    "convex": "^1.18.2",
    "next": "15.1.3",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "styled-components": "^6.1.14",
    "swr": "^2.3.0"
  },
  "devDependencies": {
    "@eslint/eslintrc": "^3",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "eslint": "^9",
    "eslint-config-next": "15.1.3",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5.7.3"
  }
}

fixed by setting build root directory

1 Like

Thanks for sharing what worked for you, Peter!

1 Like

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