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

不羁岁月 提交于 2019-12-23 20:43:22

问题


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).


回答1:


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

E.g. 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.



来源:https://stackoverflow.com/questions/47048817/how-do-i-tell-which-version-of-material-ui-to-install-for-my-react-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!