I use a PORT environment variable to change the port of the server:
I tried to put the following in .env:
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.
I use a
PORTenvironment variable to change the port of the server:I tried to put the following in .env:
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:
But that'd be very nice if .env would work in a more intuitive way.