Steps to Create the Next App
Step 1: Set up Next.js Project using the Command:
npx create-next-app port-change
Step 2: Navigate to the Project folder using:
cd port-change
Project Structure:
The updated dependencies in package.json file will look like:
"dependencies": {
"react": "^18",
"react-dom": "^18",
"next": "14.2.1"
}
How to change port in Next.js App
Next.js provides the flexibility to change the default port of the development server using command-line options such as -p <port_number> or by updating the “scripts” section in the package.json file, offering developers multiple ways to customize the port configuration based on their requirements.
Table of Content
- 1. Updating package.json File
- 2. Specify Port Number in Run Command