Something went wrong while setting issue due date.
PORT env variable is not supported in .env
Closed
PORT env variable is not supported in .env
Created by: gmarty
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.