1

I have a ReactApp that is currently running on port 3000.

Now, when I started another NextJS App and decided to test it out, it gives the error:

Error: listen EADDRINUSE: address already in use 0.0.0.0:3000

This makes no sense. If it were regular ReactJS, ReactJS would immediately ask me if they should use another port, the moment I select Yes ReactJS will automatically switch to another port and start the application. Why can't NextJS follow same approach instead of failing immediately.

I don't expect that I would now have to kill my ReactApp running on port 3000 just so NextApp can run.

Is there a way around this?

Thank you.

ololo
  • 1,326
  • 2
  • 14
  • 47

1 Answers1

0

You need to run your next server on another port.

Try doing this in package.json

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

8080 => The port you want.

Mehul Thakkar
  • 2,177
  • 13
  • 22