简体   繁体   English

找不到模块:错误:无法解析“C:\Users\Meenakshi\OneDrive\Documents\react apps\memories\client\src”中的“@material-ui/core”

[英]Module not found: Error: Can't resolve '@material-ui/core' in 'C:\Users\Meenakshi\OneDrive\Documents\react apps\memories\client\src'

I was working on a web application which uses MERN.我正在开发一个使用 MERN 的 web 应用程序。 I have installed @material-ui/core but it is throwing an error like Module not found: Error: Can't resolve '@material-ui/core' in 'C:\Users\Meenakshi\OneDrive\Documents\react apps\memories\client\src' My import files are-我已经安装了@material-ui/core,但是它抛出了一个错误,比如找不到模块:错误:无法在'C:\Users\Meenakshi\OneDrive\Documents\react apps\ 中解析'@material-ui/core' memory\client\src' 我的导入文件是-

import React from "react";
import { Container, AppBar, Typography, Grow, Grid } from "@material-ui/core";
import memories from "./images/memories.png";

And the dependencies looks like-依赖项看起来像 -

"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
}

I'm importing it using the command-我正在使用命令导入它-

    $ npm install @material-ui/core

and have also tried-并且也尝试过——

    $ npm install i @material-ui/core

Instead of importing whole material ui core, you can import specifically what you need.您可以专门导入您需要的内容,而不是导入整个材质 ui 核心。

for version 4.x Examples:对于版本 4.x示例:

import { makeStyles } from '@material-ui/core/styles';

import { Box, Grid } from '@material-ui/core';

and in your package.json在你的 package.json

"@material-ui/core": "^4.11.0",

if using version 5.x如果使用版本 5.x

npm install @mui/material @emotion/react @emotion/styled

import Button from '@mui/material/Button';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到模块:无法在“D:\own_files\ReactTutorial\react-app\src”中解析“@material-ui/core/Avatar” - Module not found: Can't resolve '@material-ui/core/Avatar' in 'D:\own_files\ReactTutorial\react-app\src' 找不到模块:无法解析“@material-ui/core/AppBar” - Module not found: Can't resolve '@material-ui/core/AppBar' 找不到模块:无法解析“@material-ui/core/Container” - Module not found: Can't resolve '@material-ui/core/Container' 找不到模块:无法解析“@material-ui/core/Breadcrumbs” - Module not found: Can't resolve '@material-ui/core/Breadcrumbs' 找不到模块:无法解析“@material-ui/styles”(反应) - Module not found: Can't resolve '@material-ui/styles' (React) 找不到模块:无法在React中解析'@ material-ui / core / RaisedButton' - Module not found: Can't resolve '@material-ui/core/RaisedButton' in React 未找到模块:错误:无法解析“@material-ui/core/styles”(部署到 heroku 时) - Module not found: Error: Can't resolve '@material-ui/core/styles' (when deploying to heroku) 找不到模块:无法解析“/home/sanika/Desktop/Coding/React/my-forms/src/Components”中的“@material-ui/lab/TabContext” - Module not found: Can't resolve '@material-ui/lab/TabContext' in '/home/sanika/Desktop/Coding/React/my-forms/src/Components' React - Material UI | 找不到模块:无法解析“material-ui/Button” - React - Material UI | Module not found: Can't resolve 'material-ui/Button' Material UI React - 找不到模块:无法解析“@material-ui/pickers” - Material UI React - Module not found: Can't resolve '@material-ui/pickers'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM