Skip to content

PORT env variable is not supported in .env #727

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

Closed
gmarty opened this issue Sep 23, 2016 · 3 comments
Closed

PORT env variable is not supported in .env #727

gmarty opened this issue Sep 23, 2016 · 3 comments
Milestone

Comments

@gmarty
Copy link

gmarty commented Sep 23, 2016

I use a PORT environment variable to change the port of the server:

PORT=8000 npm start

I tried to put the following in .env:

PORT=8000

But when I run npm start, the default port (3000) is used. I was expecting the .env file to work in this case.

I understand the content of .env is to specify environment variables to be used in the app, but that's a bit confusing that the above doesn't work.

A workaround is to modify the package.json this way:

"start": "PORT=8000 react-scripts start",

But that'd be very nice if .env would work in a more intuitive way.

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

.env has a notice about being available since 0.5.0.
I think you are using 0.4.2 because I'm releasing 0.5.0 later today. :-)

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

Closing as fixed in 0.5.0.
Please wait for the update in an hour or so.

@gaearon gaearon closed this as completed Sep 23, 2016
@gaearon gaearon added this to the 0.5.0 milestone Sep 23, 2016
@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

0.5.0 has just been released. Can you give it a try?

See migration instructions and breaking changes in 0.5.0.

@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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants