Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #727
Closed
Open
Issue created Sep 23, 2016 by Administrator@rootContributor

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.

Assignee
Assign to
Time tracking