Search code examples
next.jstsx

Next.js 14 Not recognizing pages within /app


I am pretty new to Next, and I am trying to help start migrate the /pages directory over to /app to gain full advantage of next 14. However, as I am following the documentation to migrate I am running into issues with attempting to redirect to a page within my app.

currently my app directory is set up very simply like so:

app
|--layout.tsx
|--Test
|  |-- page.tsx

Then going to http://localhost:3000/test it gets /not-found and I get the following browser error: enter image description here

Watching tutorials online and they seem to seamlessly migrate parts of their /pages over to their /app. I'm not sure what I am doing wrong.

This is my layout.tsx:

export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  )
}

any help would be great thanks!


Solution

  • Just an update on this problem. It seems that my pageExtensions parameter within my next.config.js was the culprit. Unfortunately now my existing /pages routes do not work and only my /app routes work now.

    There seems to be something similar (but not really) here:https://github.com/vercel/next.js/discussions/48809