Skip to content

PORT env variable not always an integer #1584

@matoilic

Description

@matoilic
Contributor

Description

When setting the PORT env variable it is a string, no matter if I set it like PORT="8088" or PORT=8088. This causes the port check in the start script if (port === DEFAULT_PORT) to always fail. port is an integer and DEFAULT_PORT a string. It also causes the kitchensink e2e test to hang.

Expected behavior

The server should start at the given port.

Actual behavior

The start script complains that something is already running on the given port.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected): react-scripts@0.9.0
  2. node -v: v6.9.4
  3. npm -v: 3.10.10

Then, specify:

  1. Operating system: macOS 10.12.3
  2. Browser and version: is not a browser issue

Reproducible Demo

Try starting the development server with PORT=3002 npm start

Activity

Timer

Timer commented on Feb 18, 2017

@Timer
Contributor

Hmm, odd. I can't reproduce using .env or the command line. Thanks for the report, nevertheless!

added this to the 0.9.1 milestone on Feb 18, 2017
matoilic

matoilic commented on Feb 18, 2017

@matoilic
ContributorAuthor

I've retested it on other machines and the only one I can reproduce it on is again a Mac (El Capitan) with Bash. When using other shells or operating systems the PORT env variable is already an integer without converting it previously.

added a commit that references this issue on Feb 19, 2017
a5f8b88
added a commit that references this issue on Feb 22, 2017
c0b5b78
added a commit that references this issue on Feb 23, 2017
71be55b
added a commit that references this issue on Mar 2, 2017
3aba7bc
added a commit that references this issue on May 8, 2017
7d599f7
added a commit that references this issue on May 16, 2017
7a11edd
locked and limited conversation to collaborators on Jan 22, 2019
added a commit that references this issue on Feb 24, 2019
2c8ffb0
added a commit that references this issue on Oct 8, 2024
5196ea3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @matoilic@Timer@gaearon

        Issue actions

          PORT env variable not always an integer · Issue #1584 · facebook/create-react-app