Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If port is already being used then start server on a different port. #85

Closed
tlrobinson opened this issue Jul 22, 2016 · 12 comments
Closed

Comments

@tlrobinson
Copy link
Contributor

Currently if I already have a different server listening on port 3000 then react-scripts start still starts up and says The app is running at http://localhost:3000/, but it's actually not.

It should either fail to start up (in which case there should be a way to manually specify a different port) or automatically pick an available port.

@sotojuan
Copy link

If accepted, I can work on this using this module.

@eanplatter
Copy link
Contributor

I noticed this issue too, I'd prefer to have it just throw an error personally. If you start switching ports dynamically it can get confusing, especially for newer users who will be referencing the docs.

@sotojuan if you have a solution in mind make a PR :) It's easier to get into more nitty gritty discussion on a PR.

@gaearon
Copy link
Contributor

gaearon commented Jul 22, 2016

I think it should ask: Something is already running at http://localhost:3000. Would you like to run the app at another port instead? [Y/n]

@gaearon
Copy link
Contributor

gaearon commented Jul 22, 2016

But yes, this is accepted, and we can discuss specific UX in a PR.

@0xcaff
Copy link

0xcaff commented Jul 23, 2016

It would be nice if you could specify the port too.

@gaearon
Copy link
Contributor

gaearon commented Jul 23, 2016

I’d like to try an automatic way first.
If people will still complain after we add it, we’ll definitely allow specifying it.

@chocnut
Copy link
Contributor

chocnut commented Jul 23, 2016

@gaearon here's a PR for a prompt if port is in use #101

@gaearon
Copy link
Contributor

gaearon commented Jul 23, 2016

Yep, I’ll review next week. 👍

@gaearon
Copy link
Contributor

gaearon commented Jul 27, 2016

This was fixed in #243.

@gaearon gaearon closed this as completed Jul 27, 2016
@gaearon
Copy link
Contributor

gaearon commented Jul 27, 2016

Should be out in 0.2.0 alpha, please help us test it. #190

@gkaemmer
Copy link

Strangely, I'm finding that create-react-app 0.2.3 still is unable to detect another service running at port 3000. I have a Rails app running on 3000, and npm start still outputs:

Compiled successfully!

The app is running at:

  http://localhost:3000/

Note that the development build is not optimized.
To create a production build, use npm run build.

When I go to http://localhost:3000, I only get the Rails app. I'm on a Mac running El Capitan. Anyone else running into this?

@gaearon
Copy link
Contributor

gaearon commented Aug 27, 2016

We use detect-port so you can try this library separately and file issues if you figure out what's wrong. Its code is pretty small.

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants