To work.
Failed to compile.
yarn global add create-react-app
create-react-app my-app --scripts-version=react-scripts-ts
cd my-app
v1.0.0-beta.46yarn add material-ui@next
src/App.tsx...
import AppBar from 'material-ui/AppBar';
...
<AppBar position="static" />
yarn startError you get is
Failed to compile.
./node_modules/material-ui/styles/withStyles.js
Module not found: Can't resolve '@babel/runtime/core-js/map' in '/Users/talha/Repos/temp/my-app/node_modules/material-ui/styles'
| Tech | Version |
|--------------|---------|
| Material-UI | ^1.0.0-beta.46 |
| React | ^16.3.2 |
Submitted same issue in same time https://github.com/mui-org/material-ui/issues/11286
Try installing @babel/runtime or using v1.0.0-beta.45. I have forgotten about it :/.
As @oliviertassinari stated npm install @babel/runtime fixed the problem for me.
PS: You don't have to switch back to v1.0.0-beta.45.
Try installing @babel/runtime or using v1.0.0-beta.45.
v1.0.0-beta.45 has the same issue.
I have been having this issue in v1.0.0-beta.44/43 also. I think it's worth noting that I was not having this issue until about 3 hours ago (nearly the same time as the OP), when I cleaned out node_modules and did a fresh yarn install, Is it possible that something changed with the babel package MUI is using? Installing @babel/runtime worked for me. Also, one thing I noticed before I came across this workaround was that node_modules had babel-runtime/core-js and not babel/runtime/core-js.
I'm moving the next tag from beta.46 to beta.45 waiting for the beta.47 release to fix the problem.
npm dist-tag add [email protected] next.
@HarryCaveMan I faced the same problem with v1.0.0-beta.44. I observed one strange thing, when I installed @babel/runtime before the babel-rutime , the compilation was still giving the errors, but when I installed babel-runtime before installing the @babel/runtime it worked. Strange.
I encountered this issue last night and it didn't go away even when I switched to beta.41 and cleared my lockfile and node_modules directory. Really bizarre, but I can confirm that installing @babel/runtime as a dev dependency fixes the issue.
I'm releasing v1.0.0-beta.47 with the fix. Next release will be v1.0.0-rc.0.
i had the same problem, but it was solved after updating the Material-UI's version .
npm install @material-ui/core https://material-ui.com/getting-started/installation/
For me it worked with version 1.5.0 but did not worked with 1.51.
So I downgrade it to that seems to more stable or am I wrong?
Most helpful comment
Try installing
@babel/runtimeor using v1.0.0-beta.45. I have forgotten about it :/.