Monday, January 24, 2022

Change default Port on Next.js app

 If any other app or process is running on port 3000, you will get this error in your terminal


Port 3000 is already in use.

error Command failed with exit code 1.


Solutions

To set it inside your package.json's script section.

"scripts": {

    "dev": "next -p 3040", // This will change it for dev environment

    "build": "next build",

    "start": "next start -p 3040" // This will change it for the production

}

Change default Port on Next.js app

 If any other app or process is running on port 3000 , you will get this error in your terminal Port 3000 is already in use. error Command f...