Setting up Next.js
We are now going to set up a new project using the create-next-app
tool, which sets up everything automatically for us. Follow these steps to get started:
- Open a new Terminal window. Make sure you are outside of any project folders. Run the following command to create a new folder and initialize a Next.js project there:
$ npx [email protected]
- When asked if it’s Ok to proceed?, press
y
and confirm by pressing Return/Enter. - Give the project a name, such as
ch16
. - Answer the questions as follows:
- Would you like to use TypeScript?: No
- Would you like to use ESLint?: Yes
- Would you like to use Tailwind CSS?: No
- Would you like to use `src/` directory?: Yes
- Would you like to use App Router?: Yes
- Would you like to customize the default import alias?: No
- After answering all the questions, a new Next.js app will be created in the
ch16
folder. The output should look as follows:
Figure 16.1 – Creating a new Next...