7

When creating a Next.js app in VS Code, I run the following command: 'npx create-next-app@latest' and go through the process of creating the app. However, Next.js's website shows that I should have a 'pages' and 'styles' folder along with the 'app' and 'public' folder. I am unsure if this has to do with the 'Would you like to use...' section when creating the app if I am selecting the wrong options or what.

'Would you like to use...' section Top level files and folders I am seeing

I updated Node.js and recreated the application multiple times using different selections in the 'Would you like to use...' section. I was hoping the folders would appear, but no success. I am unsure where to go here as I am new to using Next.js.

zachrm25
  • 73
  • 1
  • 3

1 Answers1

20

When you create a new project with the latest create-next-app, it uses the recently released App Router feature by default. Hence, your project contains the app directory instead of pages.

If you prefer not to use the App Router, you should answer "No" to the "Use App Router (recommended)?" question. In this case your project will contain the pages directory.

$ npx create-next-app@latest
✔ What is your project named? … nextjs-project
✔ Would you like to use TypeScript with this project? … Yes
✔ Would you like to use ESLint with this project? … Yes
✔ Would you like to use Tailwind CSS with this project? … No
✔ Would you like to use `src/` directory with this project? … No
✔ Use App Router (recommended)? … No
✔ Would you like to customize the default import alias? … No
$ tree -d -L 1 nextjs-project
nextjs-project
├── node_modules
├── pages
├── public
└── styles
Igor Danchenko
  • 1,980
  • 1
  • 3
  • 13