You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Material UI Typography模块未找到,单独安装后项目编译失败求助

Fix: Module not found: Can't resolve 'material-ui/Typography'

Let's break down what's going wrong and fix this step by step:

Why this error happens

First off, the import path material-ui/Typography is outdated—Material UI uses scoped packages (prefixed with @material-ui/) now. On top of that, the standalone @material-ui/typography package you installed isn't meant to provide the Typography component itself; it's a utility package for customizing typography themes. The actual Typography component lives in the @material-ui/core package.

Step 1: Fix your dependencies

If you only need the Typography component, uninstall the standalone typography package first:

# Using npm
npm uninstall @material-ui/typography

# Using yarn
yarn remove @material-ui/typography

Then install the core Material UI package which includes the Typography component:

# Using npm
npm install @material-ui/core

# Using yarn
yarn add @material-ui/core

Step 2: Correct your import statement

In your src/App.js, update the import line to use the correct scoped path:

// Replace this
import Typography from 'material-ui/Typography'

// With this
import Typography from '@material-ui/core/Typography'

If you actually need the standalone @material-ui/typography package

If you're trying to customize your app's typography theme (not just use the component), keep both packages installed but make sure you import the utilities correctly:

// For theme customization
import { createTypography } from '@material-ui/typography'
// For the actual component
import Typography from '@material-ui/core/Typography'

After making these changes, your project should compile without issues!

内容的提问来源于stack exchange,提问作者Sara

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:13:12