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
Run npm run dev and the NextJS application will start on port 3002.
To change the default port for a create-react-app project, update the start command in your package. json file to specify the port, e.g. "PORT=3456 react-scripts start" on macOS and Linux and "set PORT=3456 && react-scripts start" on Windows.
This work for me
"scripts": { "dev": "next -p 8080" },
"scripts": { "dev": "next dev -p 8080", // for dev "start": "next start -p 8080" // for prod },
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With