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

How to set the default port? #427

Comments

@SidKwok
Copy link

SidKwok commented Aug 12, 2016

Because of my company's limitation, I have to use port 8000~9000. So how can I solve this problem?

@gaearon
Copy link
Contributor

gaearon commented Aug 12, 2016

The default port is determined by PORT environment variable so you can put that next to your start command. For example, you can change react-scripts starts in your package.json to PORT=8000 npm start (or set PORT=8000&npm start on Windows).

@gaearon gaearon closed this as completed Aug 12, 2016
@SidKwok
Copy link
Author

SidKwok commented Aug 12, 2016

Oh, big thanks. I think it would be better if this is mentioned in the readme.

@kevinSuttle
Copy link

Where is 3000 set in the source code? I need to be able to set that to an environment variable.

@gaearon
Copy link
Contributor

gaearon commented Dec 13, 2016

I need to be able to set that to an environment variable.

You can already set the PORT environment variable to anything and it will work.
3000 is just the default.

I think it would be better if this is mentioned in the readme.

I agree, we plan to document this soon.

@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.