'@mui/system' 应该在项目的依赖项中列出

'@mui/system' should be listed in the project's dependencies

我刚刚在我的 create react app typescript 项目中安装了 MUI v5.4,我想导入

import { createTheme } from '@mui/system';

但是 eslint 一直显示这个错误

'@mui/system' should be listed in the project's dependencies.

和@mui/system 在我的 package.json

依赖项中
"dependencies": {
    "@babel/plugin-proposal-private-property-in-object": "^7.16.7",
    "@mui/material": "^5.4.3",
    "@mui/styled-engine-sc": "^5.4.2",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^12.0.0",
    "@testing-library/user-event": "^13.2.1",
    "@types/jest": "^27.0.1",
    "@types/node": "^16.7.13",
    "@types/react": "^17.0.39",
    "@types/react-dom": "^17.0.9",
    "@types/react-redux": "^7.1.22",
    "@types/redux-saga": "^0.10.5",
    "axios": "^0.26.0",
    "eslint-import-resolver-typescript": "^2.5.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-redux": "^7.2.6",
    "react-router-dom": "^6.2.1",
    "react-scripts": "5.0.0",
    "redux": "^4.1.2",
    "redux-saga": "^1.1.3",
    "styled-components": "^5.3.3",
    "typescript": "^4.4.2",
    "web-vitals": "^2.1.0"
},

我已经在 .eslintrc 中尝试了下面的这个解决方案,但它没有用

"import/no-extraneous-dependencies": ["error", {"devDependencies": true}]

and @mui/system is in my dependencies in package.json

我在那里没看到。您有 @mui/material@mui/styled-engine-sc,但没有 @mui/system

npm install @mui/system 解决这个问题。