问题
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