reactjs MUI依赖冲突React

oyxsuwqo  于 2023-05-22  发布在  React
关注(0)|答案(1)|浏览(134)

我正在尝试使用mui图标和组件部署React项目。在Vercel上部署时,我收到这样的错误:errors
这是我的包裹。lock:

{
  "name": "course",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.12.4",
    "@material-ui/icons": "^4.11.3",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "firebase": "^9.21.0",
    "react": "^18.2.0",
    "react-beautiful-dnd": "^13.1.1",
    "react-dom": "^18.2.0",
    "react-fade-in": "^2.0.1",
    "react-redux": "^8.0.5",
    "react-router-dom": "^6.11.1",
    "react-scripts": "5.0.1",
    "react-textarea-autosize": "^8.4.1",
    "redux": "^4.2.1",
    "redux-thunk": "^2.4.2",
    "uuid": "^9.0.0",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "redux-devtools-extension": "^2.13.9"
  }, 
  
  "peerDependencies": {
    "react": "^18.1.0"
  }
}

我已经尝试运行npm install --save --legacy-peer-deps并将"peerDependencies": { "react": "^18.1.0"}添加到我的package.lock文件中。它没有帮助。在这种情况下,我应该怎么做更好?

gjmwrych

gjmwrych1#

Material UI v4(@material-ui/core)不支持React 18。将Material UI升级到v5(@mui/material)或使用React 17。

相关问题