简体   繁体   中英

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? (ie 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).

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

Eg npm view material-ui@0.17.3 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.

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

For example:

npm i @material-ui/core@4.11.4

You can check the latest release material-UI version on this official webpage: https://mui.com/versions/

You can check your installed material-UI and other packages & versions.

Open the "package.json" file then you can see your installed packages and versions.

Like this: enter image description here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM