Skip to content

Passing a bad HOST causes the port check to fail #2179

Closed
@gaearon

Description

@gaearon

The failure doesn't look great:

env HOST=nono npm start

? Something is already running on port 3000.
Would you like to run the app on another port instead? (Y/n) 

/Users/gaearon/p/create-react-app/packages/react-scripts/scripts/start.js:17
  throw err;
  ^

RangeError: "port" argument must be >= 0 and < 65536
    at assertPort (internal/net.js:17:11)
    at Server.listen (net.js:1382:5)
    at Server.listen (/Users/gaearon/p/create-react-app/packages/react-scripts/node_modules/webpack-dev-server/lib/Server.js:431:47)
    at run (/Users/gaearon/p/create-react-app/packages/react-scripts/scripts/start.js:133:13)
    at inquirer.prompt.then.answer (/Users/gaearon/p/create-react-app/packages/react-scripts/scripts/start.js:171:9)

We should handle the case with undefined port properly and show a better message (or should the Promise have been rejected?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions