"proxy": "http://localhost:6000"
当我添加 package.json时,我在项目中遇到了这个错误。
这是纱线启动后的错误响应。
选项对象无效。开发服务器已使用与 API 架构不匹配的选项对象进行初始化。
- options.allowedHosts[0] 应该是一个非空字符串。error 命令失败,退出代码 1。 info 请访问 https://yarnpkg.com/en/docs/cli/run以获取有关此命令的文档。
但当我删除后一切都很好"proxy": "http://localhost:6000"。
这是我的 package.json 上的:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.12.3",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.24.0",
"moment": "^2.29.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-file-base64": "^1.0.3",
"react-redux": "^7.2.6",
"react-scripts": "5.0.0",
"redux": "^4.1.2",
"redux-thunk": "^2.4.1",
"web-vitals": "^2.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [ …Run Code Online (Sandbox Code Playgroud)