If you are trying to run a next app, you can change the port by updating the scripts in package.json.
"scripts": { "dev": "next dev --port 3002",