Javascript – How to Set port in next.js

javascriptnext.jsnpmportreactjs

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

Best Answer

This work for me

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