我有一个react应用程序,并试图将它部署到Heroku和runnung git push heroku master中。
模块未找到:错误:无法解析“@material ui/core/styles”
我搜索了类似的问题,并安装了最新版本的npm,节点和元用户界面,我也尝试过npm install @material-ui/core .不起作用。
以下是完整的错误日志文件
编译失败。模块未找到:错误:无法解决‘@资料-ui/核心/样式’在'/tmp/build_a49639db14111a3c4e29b2f3e9e25c49/src‘npm!代码ELIFECYCLE npm错误!错误1国家预防机制错误!游乐园-欧洲@0.1.0Build:
react-scripts buildnpm!退出状态1 npm错误!国家预防机制错误!在游乐园失败-欧洲@0.1.0构建脚本。国家预防机制错误!这可能不是npm的问题。上面可能还有额外的日志输出。国家预防机制错误!这个运行的完整日志可以在: npm!/app/.npm/_logs/2018-10-08T20_29_28_807Z-debug.log中找到!推拒绝,未能编译React.js (创建-反应-应用)多应用程序。好了!推送失败
该项目可以在github 使用google响应应用程序上找到。
谢谢你的帮助,我尝试了很多想法,却没有找到解决的办法。
发布于 2018-10-17 14:36:10
这个问题根据@samokasha的答案解决了,解决方案是使用npm install @material-ui/core --save
我以前使用过相同的命令,但是我忽略了--save
谢谢你的帮助。
发布于 2018-10-15 16:29:41
看起来您的package.json文件不包括资料-ui。尝试'npm -s @material ui/core‘
发布于 2022-09-19 05:28:06
如果您使用的是MUI 5,则需要更改此
v5
import { withStyles } from '@mui/material/styles';
V4
import { withStyles } from '@material-ui/core/styles';https://stackoverflow.com/questions/52820236
复制相似问题