开发者问题收集

未找到模块:错误:无法解析‘@mui/base’

2022-06-05
10593

我刚刚安装了 Material UI,发现如下消息:

Compiled with problems:

ERROR in ./node_modules/@mui/material/AccordionActions/AccordionActions.js 7:0-70

Module not found: Error: Can't resolve '@mui/base' in 'C:\..\node_modules\@mui\material\AccordionActions'

顺便说一下,我使用 yarn。 在终端我得到

webpack compiled with 253 errors and 1 
warning

这是我的 package.json 依赖项:

 "dependencies": {
    "@emotion/react": "^11.9.0",
    "@emotion/styled": "^11.8.1",
    "@mui/icons-material": "^5.8.2",
    "@mui/material": "^5.8.2",
    "@mui/styled-engine-sc": "^5.8.0",
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.3.0",
    "@testing-library/user-event": "^13.5.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "5.3.0",
    "react-scripts": "5.0.1",
    "styled-components": "^5.3.5",
    "web-vitals": "^2.1.4"
  },

我已经使用 yarn add @mui/base ,但仍然这样,有解决方法吗?

2个回答

首先只需安装 mui 基础。 如果您使用的是 npm,则使用此命令:

npm install @mui/base

如果您使用的是 yarn,则使用此命令:

yarn add @mui/base
Rana Faraz
2022-06-06

查看以下链接: 第一个是官方 Material UI,第二个是 npm

  1. https://mui.com/base/getting-started/installation/
  2. https://www.npmjs.com/package/@mui/base
Meet Majevadiya
2022-06-05