skip to Main Content

So, I’m new to nextJS. I installed the latest version (13.3.4) using npx create-next-app@latest and it works, serves on port 3000 etc.

Now I’m learning about an app directory that houses some layout.tsx and page.tsx files, but I cannot find them in the project files.

I have checked their documentation, even manually adding the app directory and the layout and page files, and made changes to them, but nothing changed.

enter image description here

What is happening?

Update:

This is the next.config.js file

enter image description here

2

Answers


  1. In order to do that, you have to run npx create-next-app project again. Then in the terminal, you’ll be asked to either have the app directory or not.

    Login or Signup to reply.
  2. create-next-app comes with some options, run the following command to see

    npx create-next-app@latest -h
    

    among all the available options, there is an --app option

    –app

    Initialize as an App Router project.

    so you can run with the --app option specified to make sure the app folder get created.

    npx create-next-app@latest --app
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search