How to Create a New Next.js App
Next.js helps us to create web applications using React. It is an isomorphic application that supports both server side and client side rendering of React.
In order to start a new project in Next.js, Go to a folder in terminal. This is where we are going to create the Next.js project.
Then type one of the following commands.
npx create-next-app # or yarn create next-app
If you are using
yarn, yarn needs to be installed globally in your machine.
After hitting enter after above command, Next.js will ask for project name. There we can provide a project name which is going to be the folder in which the app is going to reside.
yarncommand, there is no dash(-) in
create next-appcommand when compared to
In my case, I used
yarn. When I run
yarn create next-app, the interactive process asks me the project name like below:
yarn create v1.22.5 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 🔨 Building fresh packages... success Installed "firstname.lastname@example.org" with binaries: - create-next-app ? What is your project named? › my-app