Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

Default port is conflicting with node/rails backend #52

Closed
deksden opened this issue May 2, 2017 · 3 comments · Fixed by #56
Closed

Default port is conflicting with node/rails backend #52

deksden opened this issue May 2, 2017 · 3 comments · Fixed by #56

Comments

@deksden
Copy link
Contributor

deksden commented May 2, 2017

Default port for React app is conflicting with Node's default port 3000. It will be better to change it, because for Rails app 3000 is also default port.

Just look at angular projects with 4000+ port range.

@deksden
Copy link
Contributor Author

deksden commented May 2, 2017

We can add .env file for port (https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-development-environment-variables-in-env)

or we can change package.json's start script (not sure if its cross platform): some discussion is here: facebook/create-react-app#1083

IMHO, .env way is better.

@sandeesh
Copy link
Member

sandeesh commented May 2, 2017

Most of the frontend and backend here work on the default port to keep things simple for beginners. You have a valid point though. Trying to run the rails or node backend with this would definitely cause port conflicts. Using cross-env could be a good idea. Shipping with a default port and providing instructions to change the port in the readme would be a great addition.

@deksden
Copy link
Contributor Author

deksden commented May 2, 2017

I m totally for begginer's simplicity of starting playing with stuff. But as for now you can not run this project in default configuration from repo : you should change port. Changing port for CreateReactApp-based project is not transparent - you should do some googling.

  1. For me, solution was as simple as adding .env file with "PORT=4100" line inside - React is already configured to use dotenv file.

  2. Or, maybe project should have one more dev package (cross-env) and we should change start script in package.json.

But i m sure we should do something - 1) or 2)

update: React have .env file gitignored and we can not add this to repo to prevent port conflict in default installation. So, if we want to go first way, user should do it manually.

Way 2 have one more dev-dependency, but works cross-platform and tested ok. Here is PR for fix: #56

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants