【问题标题】:Material ui icons材质 ui 图标
【发布时间】:2021-11-15 08:19:08
【问题描述】:

问题描述

我有一个带有 material-ui 的 react-django 应用程序。我以前导入和 material-ui 图标 没有任何问题。今天,从 ma​​terial-ui 导入新图标后,我什至无法构建我的应用程序。

从'@mui/icons-material/Web'导入WebIcon;

这是我尝试启动我的 react 应用时的错误消息,

> react-scripts start
Starting the development server...
Failed to compile.

./node_modules/@mui/icons-material/utils/createSvgIcon.js
 Module not found: Can't resolve '@mui/material/utils' in 
'/home/ztaye/Documents/Work/Afropa/code/afropa/frontend/node_modules/@mui/icons- 
material/utils'
/home/ztaye/Documents/Work/Afropa/code/afropa/frontend/node_modules/react- 
scripts/scripts/start.js:19
throw err;
^

Error: ENOENT: no such file or directory, stat '/initrd.img'

期待

我只是怀疑错误来自他们的新更新。我尝试使用这个link 重新安装软件包,但没有成功。

【问题讨论】:

    标签: reactjs material-ui


    【解决方案1】:

    我不知道 Django,但在我的 React 中我导入: 从'@material-ui/icons/ArrowForwardIos'导入ArrowForwardIosIcon;

    如果你像这样安装它:npm i @material-ui/icons

    【讨论】:

    • 如前所述,我是这样安装的
    【解决方案2】:

    这是从 material-ui 更新后的向后兼容性问题。全部替换后就开始工作了

    @mui/icons-material/
    

    到

    @material-ui/icons/
    

    在每个图标导入时。

    【讨论】:

      猜你喜欢
      • 2021-03-05
      • 1970-01-01
      • 1970-01-01
      • 2021-02-09
      • 2020-02-06
      • 1970-01-01
      • 2021-04-18
      • 2021-02-15
      • 2019-10-05
      相关资源
      最近更新 更多