To install Next.js, you need to have Node.js installed on your machine.
Check the node version installed in your machine, to check run node -v in your terminal
The recommended installation of Next.js is to use
npx create-next-app@latest command. This will install all the necessary files and set up everything.
If you want to use typescript, add –typescript after the command.
npx create-next-app@latest --typescript
After the installation is complete, cd to your project and run these commands
npm run dev
Go to localhost:3000
Problems in installation
- “Failed to load next.config.js”
Check the version of node installed in your machine. I use the latest version 16.14.0. It is important to use 12.22.0 or higher version