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.
If accepted, I can work on this using this module.
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.
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]
But yes, this is accepted, and we can discuss specific UX in a PR.
It would be nice if you could specify the port too.
I鈥檇 like to try an automatic way first.
If people will still complain after we add it, we鈥檒l definitely allow specifying it.
@gaearon here's a PR for a prompt if port is in use #101
Yep, I鈥檒l review next week. 馃憤
This was fixed in #243.
Should be out in 0.2.0 alpha, please help us test it. https://github.com/facebookincubator/create-react-app/pull/190
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?
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.
Most helpful comment
It would be nice if you could specify the port too.