i have a react application and trying to deploy it to Heroku and when runnung git push heroku master
Module not found: Error: Can't resolve '@material-ui/core/styles'
I searched for similar issues and installed the latest versions of npm, node and metarial-ui also i tried npm install @material-ui/core
..didn't work.
here is the full error-log file
-----> Build succeeded: =====> Downloading Buildpack: https://github.com/mars/create-react-app-inner-buildpack.git =====> Detected Framework: React.js (create-react-app) Writing
static.json
to support create-react-app Enabling runtime environment variables amusement-parks-europe@0.1.0 build /tmp/build_a49639db14111a3c4e29b2f3e9e25c49 react-scripts build Creating an optimized production build... Failed to compile. Module not found: Error: Can't resolve '@material-ui/core/styles' in '/tmp/build_a49639db14111a3c4e29b2f3e9e25c49/src' npm ERR. code ELIFECYCLE npm ERR. errno 1 npm ERR: amusement-parks-europe@0.1.0 build:react-scripts build
npm ERR. Exit status 1 npm ERR. npm ERR. Failed at the amusement-parks-europe@0.1.0 build script: npm ERR. This is probably not a problem with npm. There is likely additional logging output above, npm ERR. A complete log of this run can be found in. npm ERR! /app/.npm/_logs/2018-10-08T20_29_28_807Z-debug.log ! Push rejected, failed to compile React.js (create-react-app) multi app. ! Push failed
and the project can be found on github react app using google Api
thanks for any help, I tried many ideas and came to no solution.
Looks like your package.json file doesn't include material-ui. Try 'npm i -s @material-ui/core'
the problem was solved according to the answer from @samokasha , the solution was using npm install @material-ui/core --save
I used the same command before but I missed the --save
thanks for the help.
check your react version and
npm install @material-ui/core --save
or
npm install @material-ui/core@next
If you are using MUI 5 You need to change this
v5
import { withStyles } from '@mui/material/styles';
V4
import { withStyles } from '@material-ui/core/styles';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.