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

Doesn't quite work with react-scripts >= 0.2.x #2

Closed
gaearon opened this issue Aug 4, 2016 · 1 comment
Closed

Doesn't quite work with react-scripts >= 0.2.x #2

gaearon opened this issue Aug 4, 2016 · 1 comment

Comments

@gaearon
Copy link
Contributor

gaearon commented Aug 4, 2016

react-scripts@0.2.x honors process.env.PORT when you run npm start.

For some reason it gets set to 5000 (is Foreman doing it?)
However the CORS headers are enabled for 3000.

So you’d either need to change npm start to PORT=3000 npm start (not cross-platform btw), or make it cross-env PORT=3000 npm start (cross-platform but needs cross-env dependency), or somehow configure Foreman to ask it to be on 3000, or just set CORS headers to use 5000.

@acco
Copy link
Member

acco commented Aug 4, 2016

Thanks for reporting, @gaearon!

Digging in, Foreman is indeed setting process.env.PORT to 5000 by default. We can pass a -p flag to Foreman to specify 3000.

Under the hood, both cross-env and foreman eventually use Node's child_process to spawn the process, so it should be cross env but I'll commandeer a Windows machine and verify.

We could get fancier, but I'm going to wait for the dust around the proxy idea to settle.

acco added a commit that referenced this issue Aug 4, 2016
@gaearon gaearon closed this as completed Aug 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants