I have just installed MUI v5.4 in my create react app typescript project and I wanted to import
import { createTheme } from '@mui/system';
but eslint keeps showing this error
'@mui/system' should be listed in the project's dependencies.
and @mui/system is in my dependencies in 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"
},
I've tried this solution below in .eslintrc but it didn't work
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}]
CodePudding user response:
and @mui/system is in my dependencies in package.json
I don't see it there. You have @mui/material
and @mui/styled-engine-sc
, but not @mui/system
.
Do npm install @mui/system
to fix this.