Material-ui: Module not found: Can't resolve 'react-jss/lib/JssProvider

Created on 8 Oct 2018  路  12Comments  路  Source: mui-org/material-ui

  • [ ] This is not a v0.x issue.
  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Current Behavior

Examples

Context


image

in material-ui 3.2.0, I find I can't use jssprovider. but 1.5.1 I can

question v1.x

Most helpful comment

I think I solved this issue by installing react-jss ^8.0.0. I got that idea after I found this PR: https://github.com/mui-org/material-ui/pull/14237

If You already npm install react-jss, You will probably get v10 of the package. To correct it, just do the following:

  • open package.json
  • and find the "react-jss" dependency and set it to ^8.0.0 instead of ^10.0.0
  • remove react-jss entry from package.LOCK.json (from the .lock file!!)
  • run npm install and hope for the best :)

All 12 comments

in 3.2, material-ui cant dependence react-jss

@sunshixiong789 npm install react-jss and you will be good. See #12993.

think you

I think it should be like before

react-jss was always a transitive dependency. You should not import transitive dependencies. Eslint even has a rule implicit-dependency against that.

@sunshixiong789 I'm considering the option of having a WithStylesProvider.

@oliviertassinari for now doing npm install react-jss solves the problem but in this way we need to install all the dependency's dependency at root of our package.json :(

@devamir What version are you using?

@oliviertassinari I was facing the issue Object(...) is not a function on upgrading the material-ui to 4.x.x and then faced this issue/. It seemed to be the issue that npm install was not installing all the sub-dependencies.

react-jss is not a dependency of v4.0.0. We might introduce it back in #16180.

I think I solved this issue by installing react-jss ^8.0.0. I got that idea after I found this PR: https://github.com/mui-org/material-ui/pull/14237

If You already npm install react-jss, You will probably get v10 of the package. To correct it, just do the following:

  • open package.json
  • and find the "react-jss" dependency and set it to ^8.0.0 instead of ^10.0.0
  • remove react-jss entry from package.LOCK.json (from the .lock file!!)
  • run npm install and hope for the best :)

@AleksandarSavic95

Material-UI depends on JSS v10. JSS v10 is not backward compatible with v9. Make sure JSS v9 is not installed in your environment. (Removing react-jss from your package.json can help). The StylesProvider component replaces the JssProvider one.

https://material-ui.com/guides/migration-v3/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sys13 picture sys13  路  3Comments

mattmiddlesworth picture mattmiddlesworth  路  3Comments

ghost picture ghost  路  3Comments

ericraffin picture ericraffin  路  3Comments

finaiized picture finaiized  路  3Comments