search
next

[SOLVED]: app/ directory is not supported in this version of Next.js error

Quick fix for 'app/ directory is not supported in this version of Next.js' error. Learn how to upgrade to use Next.js App Router.

person By Gautam Sharma
calendar_today January 8, 2026
schedule 2 min read
Next.js App Router Upgrade Error Fix Migration

The ‘app/ directory is not supported in this version of Next.js’ error occurs when trying to use the App Router (app directory) with an older version of Next.js that doesn’t support it. The App Router was introduced in Next.js 13.0 and requires version 13.4 or later for stable usage.


How the Error Happens

❌ Error Scenario:

# ❌ This causes the error
npm run dev
# Error: app/ directory is not supported in this version of Next.js
// ❌ Having an app/ directory with old Next.js version
// app/page.js
export default function HomePage() {
  return <h1>Hello from App Router</h1>;
}

✅ Quick Fix - Upgrade Next.js Version

Solution 1: Upgrade to Latest Next.js

# ✅ Check current version
npm list next

# ✅ Upgrade to latest stable version
npm install next@latest react@latest react-dom@latest

# ✅ Or specify a minimum version that supports App Router
npm install next@^13.4.0

Solution 2: Verify Next.js Version

// ✅ In package.json, ensure Next.js version supports App Router
{
  "dependencies": {
    "next": "^13.4.0", // ✅ Minimum for stable App Router
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  }
}

Solution 3: Migrate from Pages Router to App Router

# ✅ If upgrading from Pages Router, follow migration steps:
# 1. Upgrade Next.js to 13.4+
# 2. Create app/ directory alongside pages/ (during migration)
# 3. Move routes from pages/ to app/
# 4. Update components to use App Router patterns

# ✅ Pages Router (old)
// pages/index.js
export default function Home() {
  return <h1>Welcome</h1>;
}

# ✅ App Router (new)
// app/page.js
export default function HomePage() {
  return <h1>Welcome</h1>;
}

Solution 4: Use Pages Router Instead

// ❌ If you can't upgrade Next.js, remove app/ directory
// and use pages/ directory instead

// ✅ Use pages router structure
// pages/index.js
export default function Home() {
  return <h1>Hello from Pages Router</h1>;
}

// ✅ Update next.config.js if needed
// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  // ✅ Standard pages router config
};

module.exports = nextConfig;
Gautam Sharma

About Gautam Sharma

Full-stack developer and tech blogger sharing coding tutorials and best practices

Related Articles

next

Fix: getServerSideProps is not supported in App Router Next.js error - Complete Guide

Complete guide to fix 'getServerSideProps is not supported in App Router' error in Next.js applications. Learn how to migrate from Pages Router to App Router and implement server-side rendering with the new API.

January 8, 2026
next

Fix: Invariant failed: Missing App Router context error

Quick fix for 'Invariant failed: Missing App Router context' error in Next.js. Learn how to resolve App Router context issues.

January 8, 2026
next

[SOLVED] You are importing a component that needs 'use client' error

Quick fix for 'You are importing a component that needs use client' error in Next.js App Router. Learn how to properly use client components.

January 8, 2026