Material-ui: Why show this problem

Created on 27 Jan 2017  路  5Comments  路  Source: mui-org/material-ui

When I include material ui and import into my existing project try to build with pack showing this error?

ERROR in ../~/material-ui/styles/MuiThemeProvider.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/styles
 @ ../~/material-ui/styles/MuiThemeProvider.js 27:13-29

ERROR in ../~/material-ui/AppBar/AppBar.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/AppBar
 @ ../~/material-ui/AppBar/AppBar.js 45:13-29

ERROR in ../~/material-ui/utils/propTypes.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/utils
 @ ../~/material-ui/utils/propTypes.js 7:13-29

ERROR in ../~/material-ui/svg-icons/navigation/menu.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/svg-icons/navigation
 @ ../~/material-ui/svg-icons/navigation/menu.js 7:13-29

ERROR in ../~/material-ui/IconButton/IconButton.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/IconButton
 @ ../~/material-ui/IconButton/IconButton.js 39:13-29

ERROR in ../~/material-ui/Paper/Paper.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/Paper
 @ ../~/material-ui/Paper/Paper.js 39:13-29

ERROR in ../~/material-ui/utils/childUtils.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/utils
 @ ../~/material-ui/utils/childUtils.js 9:13-29

ERROR in ../~/recompose/shouldUpdate.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/recompose
 @ ../~/recompose/shouldUpdate.js 5:13-29

ERROR in ../~/material-ui/internal/EnhancedButton.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/EnhancedButton.js 39:13-29

ERROR in ../~/material-ui/internal/Tooltip.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/Tooltip.js 39:13-29

ERROR in ../~/material-ui/SvgIcon/SvgIcon.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/SvgIcon
 @ ../~/material-ui/SvgIcon/SvgIcon.js 39:13-29

ERROR in ../~/material-ui/internal/FocusRipple.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/FocusRipple.js 31:13-29

ERROR in ../~/material-ui/internal/FocusRipple.js
Module not found: Error: Cannot resolve module 'react-dom' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/FocusRipple.js 35:16-36

ERROR in ../~/material-ui/internal/TouchRipple.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/TouchRipple.js 39:13-29

ERROR in ../~/material-ui/internal/TouchRipple.js
Module not found: Error: Cannot resolve module 'react-dom' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/TouchRipple.js 43:16-36

ERROR in ../~/material-ui/FontIcon/FontIcon.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/FontIcon
 @ ../~/material-ui/FontIcon/FontIcon.js 39:13-29

ERROR in ../~/react-addons-create-fragment/index.js
Module not found: Error: Cannot resolve module 'react/lib/ReactFragment' in /home/osmangoninahid/code/nt3lm/node_modules/react-addons-create-fragment
 @ ../~/react-addons-create-fragment/index.js 1:17-51

ERROR in ../~/material-ui/internal/ScaleIn.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/ScaleIn.js 39:13-29

ERROR in ../~/material-ui/internal/CircleRipple.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/CircleRipple.js 39:13-29

ERROR in ../~/material-ui/internal/CircleRipple.js
Module not found: Error: Cannot resolve module 'react-dom' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/CircleRipple.js 43:16-36

ERROR in ../~/recompose/utils/createEagerElementUtil.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/recompose/utils
 @ ../~/recompose/utils/createEagerElementUtil.js 7:13-29

ERROR in ../~/react-addons-transition-group/index.js
Module not found: Error: Cannot resolve module 'react/lib/ReactTransitionGroup' in /home/osmangoninahid/code/nt3lm/node_modules/react-addons-transition-group
 @ ../~/react-addons-transition-group/index.js 1:17-58

ERROR in ../~/material-ui/internal/ScaleInChild.js
Module not found: Error: Cannot resolve module 'react' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/ScaleInChild.js 39:13-29

ERROR in ../~/material-ui/internal/ScaleInChild.js
Module not found: Error: Cannot resolve module 'react-dom' in /home/osmangoninahid/code/nt3lm/node_modules/material-ui/internal
 @ ../~/material-ui/internal/ScaleInChild.js 43:16-36

question

All 5 comments

We have two peer dependencies. You need to install react & react-dom. You should have a warning from npm/yarn regarding that point. I'm closing this issue.

Next time, please submit support requests and questions to StackOverflow using the tag [material-ui]. StackOverflow is better suited for this kind of support. The issue tracker is for bug reports and feature discussions. See also our CONTRIBUTING guidelines.

Already installed react & react-dom :(

After removing node_modules folder and installing everything from beginning I had the same problem, I went to node_modules/material-ui/ and there ran npm install and that fixed the problem

Thanks

@leviathan88 I tried the same. Getting following error.

`
root@3ffdea5f8c73:/oats_workspace/fieldworkapp/node_modules/material-ui# npm install
npm ERR! addLocal Could not install /oats_workspace/fieldworkapp/node_modules/material-ui/packages/eslint-plugin-material-ui
fetchMetadata -> resolveW | |###################################################################-------------------------------------------------------------------------------------------------------------------------------------------|
WARN engine [email protected]: wanted: {"node":">=4.3.0 <5.0.0 || >=5.10"} (current: {"node":"4.2.6","npm":"3.5.2"})
fetchMetadata -> resolveW \ |###################################################################-------------------------------------------------------------------------------------------------------------------------------------------|
npm WARN deprecated [email protected]: @2.0.0
npm ERR! Linux 4.9.60-linuxkit-aufs
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! path /oats_workspace/fieldworkapp/node_modules/material-ui/packages/eslint-plugin-material-ui
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/oats_workspace/fieldworkapp/node_modules/material-ui/packages/eslint-plugin-material-ui'
npm ERR! enoent ENOENT: no such file or directory, open '/oats_workspace/fieldworkapp/node_modules/material-ui/packages/eslint-plugin-material-ui'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR! /oats_workspace/fieldworkapp/node_modules/material-ui/npm-debug.log
`

Was this page helpful?
0 / 5 - 0 ratings