question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request

When we run next dev command then before starting the server next should check for a port number 3000 is available or not if not then next should be switch to another port instead of throwing Port 3000 is already in use. error.

Is your feature request related to a problem? Please describe.

If port 3000 is locked due to another process then I’ve kill running process on port number 3000 or need to pass a port number with -p to next dev command. In my point of view, next should be switch to an available port number instead of throwing error.

Describe alternatives you’ve considered

There are two ways either you’ve to manually close port number forcefully or you’ve to pass a port number to next dev command.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
estevanmaitocommented, Jul 7, 2020

I like the create-react-app approach.

If I run a create-react-app app before a Next project, it will start on port 3000, then when I run npm run dev on my Next project, it gives me Port 3000 is already in use.

BUT, if I start my Next project before it, it takes the port 3000 and when I start create-react-app it alerts me (@jkjustjoshing would still be told that there is something running there) and gives me the opportunity to start the project on another port:

? Something is already running on port 3000.

Would you like to run the app on another port instead? (Y/n) 
4reactions
jkjustjoshingcommented, Jun 22, 2020

I’ve found that most of the time when port 3000 is in use already, it’s because I have my Next.js app already running in a different terminal window, and I appreciate being told about the issue instead of just moving to a different port.

How frequently do you have this issue? Sounds like you should just permanently change the port you develop your Next.js app on by updating your package.json:

"dev": "next -p 4000"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Definition of port switching hub - PCMag
An intelligent network hub that attaches to multiple LAN segments. Via software, it allows the station ports to be connected to one of...
Read more >
What Is a Switch Port? Types & Configuring (with pictures)
On a network switch, the switch port is the physical opening where a data cable can be plugged in. Generally, switch ports are...
Read more >
Different Types of Switch Ports - GeeksforGeeks
Network devices connect to a switch through its switch ports. Switch Ports which are physical opening where data cables are plugged in to ......
Read more >
Switch Ports, Port Managers | Comms InfoZone
A switch maintains the MAC addresses of its connected devices and knows into which port a transmission should be directed. Small business switches...
Read more >
Network switch - Wikipedia
Unlike repeater hubs, which broadcast the same data out of each port and let the devices pick out the data addressed to them,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found