Search code examples
reactjsheroku

Module not found: Error: Can't resolve '@material-ui/core/styles' (when deploying to heroku)


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 [email protected] 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! [email protected] build: react-scripts build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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 .


Solution

  • 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.