如何确定应为我的React应用安装哪个版本的Material UI? [英] How do I tell which version of Material UI to install for my react app?

查看:329
本文介绍了如何确定应为我的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.

这篇关于如何确定应为我的React应用安装哪个版本的Material UI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆