Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tell which version of Material UI to install for my react app?

I have react and react-dom 15.4.2 installed on the React starter kit I'm using and I'm trying to install material-ui; however, npm is telling me for the latest version of material UI (understandably) we need a higher version of React (16.0).

Is there a way for me to directly install the version of material-ui which is compatible with the dependencies currently existing in my package.json file? (i.e. I don't know which version this will be and I was wondering if there was a quick way to do this/look it up).

like image 802
Charles Wong Avatar asked Nov 01 '17 05:11

Charles Wong


People also ask

How do I know my material UI version?

To check version numbers, run npm list @mui/material in the environment where you build your application and also in your deployment environment. You can also ensure the same version in different environments by specifying a specific MUI version in the dependencies of your package.


2 Answers

You can check the peerDependencies of a npm package with npm view <package-name>@<package version> peerDependencies.

E.g. npm view [email protected] peerDependencies would list

{ react: '^15.4.0',
'react-dom': '^15.4.0',
'react-tap-event-plugin': '^2.0.1' }

You still would have to look up the versions from their github.

like image 80
Nash Avatar answered Oct 18 '22 23:10

Nash


You can install your specific material-ui/core version.

For example:

npm i @material-ui/[email protected]
or
npm install @material-ui/[email protected]
like image 1
Jihad Hassan Avatar answered Oct 18 '22 21:10

Jihad Hassan