How to install Next js?
Developers will need NPM to start installing Next JS with all its dependencies. Here are the steps to follow:
- Create a directory to keep the Next JS project and go into it:
mkdir my-portfolio-site
cd my-portfolio-site - Now initialize this with a package.json file.
- Use the y flag by npm init –y
- Use the below-mentioned syntax to install Next JS
npm install react react-dom next
- Update package.json with run script languages to start the initialization of Next JS application.
- Please find the package.json file on root folder and add the below mentioned script
"dev": "next",
"build": "next build",
"start": "next start"
Now, we are finished with the process.
BY Best Interview Question ON 08 Jun 2019