如何确定应为我的React应用安装哪个版本的Material UI?
我在我正在使用的React入门工具包上安装了react和react-dom 15.4.2,并且我正在尝试安装material-ui;但是,npm告诉我要使用最新版本的Material UI(可以理解),我们需要更高版本的React(16.0).
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).
我是否可以直接安装与我的package.json文件中当前存在的依赖项兼容的material-ui版本? (即,我不知道它将是哪个版本,我想知道是否有一种快速的方法来执行此操作/查找它).
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).
您可以使用npm view <package-name>@<package version> peerDependencies
检查npm软件包的peerDependencies.
You can check the peerDependencies of a npm package with npm view <package-name>@<package version> peerDependencies
.
例如npm view material-ui@0.17.3 peerDependencies
会列出
{ react: '^15.4.0',
'react-dom': '^15.4.0',
'react-tap-event-plugin': '^2.0.1' }
您仍然必须从其github查找版本.
You still would have to look up the versions from their github.