Problem Description:
https://github.com/facebook/create-react-app/issues/11762#issue-1080972271
i.e.
Set the proxy in package.json, and then start the project through npm start or yarn start, the error is as follows:
>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.
Solution: Don’t set the proxy in package.json, but set it in src/setupProxy.js, and delete the proxy in package.json, and finally restart npm start.
Read More:
- React project is packaged and set as required Error [How to Solve]
- [Solved] vueCli 4.x Upgrade to 5.x Error: Progress Plugin Invalid Options
- [Solved] Vue Start Project Error: ValidationError: webpack Dev Server Invalid Options
- How to Solve Vue-devtool Package Error
- [Solved] error when starting dev server:Error: The following dependencies are imported but could not be reso
- React: How to Solve Web3 import error
- proxy error: could not proxy request [How to Solve]
- [Solved] vue run serve Error: ValidationError: Progress Plugin Invalid Options
- [Solved] Vue cli installation Fastclick Error
- How to Solve JS error: Unexpected end of JSON input,Unexpected token u in JSON at position 0
- [Solved] Prittier format code error: JSON Error in…
- Such a simple serialization system.text.json.serialization also reports an error?
- [Solved] TypeError: Converting circular structure to JSON – JSON.stringify
- [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string. Received undefined error
- [Solved] proxy Configure Error: Error occured while trying to proxy to:
- npm connect ETIMEDOUT Error [How to Solve]
- [Solved] Vue Error: Syntax Error: TypeError: Cannot set properties of undefined (setting ‘XXX’)
- npm ERR code ELIFECYCLE [How to Solve]
- Vue init webpack Error: unable to verify the first certificate
- Vue2.0: How to Use vue3 api to encapsulate Axios