score:0

You should link @material-ui/styles in your story book so first need to npm link @material-ui/styles in your story book and than in your apps

score:0

Please try to install the below package. This helped resolve my issue.

npm i @mui/material

score:1

I had the same issue, but I do not use StoryBook. This is the first link in Google, so I post my case here, as it might help.

This is the link on how to fix the alert, but it does not work for me. npm dedupe does nothing and I am unable to change config since I am using create-react-app.

So I did following:

  1. Removed @material-ui/styles dependency from package.json
  2. Ran npm i
  3. Changed all import styles from '@material-ui/styles' to import styles from '@material-ui/core/styles'

score:1

I have an almost identical setup and ran into this exact issue when importing the components into a different project. I should mention that we're using webpack to build the app that's consuming the component. It was suggested to me to try the following in my webpackconfig:

module.exports = {
  ...
  resolve: {
    alias: {
      "@material-ui/styles": require.resolve("@material-ui/styles")
    }
  }
}

This worked great for my case.

For reference: https://webpack.js.org/configuration/resolve/


Related Query

More Query from same tag