1

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

5
  • AFAIK, you need to create the app directory and these files manually !! More info nextjs.org/docs/app/building-your-application/routing/… Commented May 5, 2023 at 5:37
  • yep i did that but nothing changed Commented May 5, 2023 at 6:19
  • Can you show your next.config.js file content? Commented May 5, 2023 at 6:32
  • I just did that @YoussoufOumar Commented May 5, 2023 at 6:57
  • 1
    Below reactStrictMode: true and this experimental: { appDir: true }. But the thing is that you don't have any app folder yet. You may wanna recreate your project as the below answer said. Also, consider pasting codes as plain formatted text, not images :) Commented May 5, 2023 at 7:29

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.