In CRA 5.0.0, `react-scripts start` fails when both `HOST` in `.env` and `proxy` in `package.json` are defined.
Created by: BalzGuenat
Describe the bug
In CRA 5.0.0, react-scripts start
fails when both HOST
in .env
and proxy
in package.json
are defined.
Did you try recovering your dependencies?
This occurs on a newly created project.
Which terms did you search for in User Guide?
"allowedHosts" and others, came up empty.
Environment
Environment Info:
current version of create-react-app: 5.0.0
running from /home/z003w3we/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app
System:
OS: Linux 5.4 Ubuntu 20.04.3 LTS (Focal Fossa)
CPU: (4) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
Binaries:
Node: 16.13.0 - ~/.asdf/installs/nodejs/16.13.0/bin/node
Yarn: 1.22.10 - ~/.asdf/shims/yarn
npm: 8.1.3 - ~/.asdf/plugins/nodejs/shims/npm
Browsers:
Chrome: 96.0.4664.45
Firefox: 95.0
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: 5.0.0 => 5.0.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
- Create a new app.
- Set
HOST
in.env
. - Set
proxy
inpackage.json
. - Run
react-scripts start
or something to that effect.
Expected behavior
App starts.
Actual behavior
I get this error:
> yarn start
yarn run v1.22.10
$ react-scripts start
Attempting to bind to HOST environment variable: test.localhost
If this was unintentional, check that you haven't mistakenly set it in your shell.
Learn more here: https://cra.link/advanced-config
Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.allowedHosts[0] should be a non-empty string.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.