Skip to content
Advertisement

How to Set port in next.js

one application is running on port 3000 and I want to run another application on a different port of the default port. How I change this in React Next.js. My package.js script is

"scripts": {
    "test": "echo "Error: no test specified" && exit 1",
    "dev": "next",
    "build": "next build",
    "start": "next start"
  },

and start script command is npm run dev

Advertisement

Answer

This work for me

 "scripts": { 
       "dev": "next dev -p 8080",
       "start": "next start -p 8080",
},
Advertisement