Skip to content

PORT env variable is not supported in .env #727

@gmarty

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions