安装时 React 和 React-Native 版本冲突 material-ui

React & React-Native versions conflict while installing material-ui

我正在尝试在 运行 react-native: 0.26.2[=21= 的新 React-Native 项目上安装 material-ui ] & 反应:“15.0.2。 当我安装 material-ui npm 包时,我收到了这些错误和警告:

npm WARN peerDependencies The peer dependency react@^15.1.0 included from react-addons-update will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency react@^15.1.0 included from react-addons-transition-group will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency react@^15.1.0 included from react-addons-create-fragment will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "material-ui"
npm ERR! node v4.2.4
npm ERR! npm  v2.14.12
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package react@15.0.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer react-native@0.26.2 wants react@15.0.2
npm ERR! peerinvalid Peer react-dom@15.1.0 wants react@^15.1.0
npm ERR! peerinvalid Peer react-tap-event-plugin@1.0.0 wants react@^15.0.0-0
npm ERR! peerinvalid Peer material-ui@0.15.0 wants react@^15.0.0

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Ali/Desktop/app/second/npm-debug.log

使用最新版本的materil-ui和最新的react-native build似乎存在版本冲突。

有没有人知道我能做什么?

我在使用 react-native init AwesomeProject 初始化的 React Native 项目中遇到了同样的错误。

我编辑了 package.json 文件,以便使用旧版本的 React,修复了版本冲突。

这是我的 package.json 文件:

{
  "name": "AwesomeProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "react": "^15.0.2",
    "react-native": "^0.26.2",
    "react-native-material-design": "^0.3.6"
  }
}

您可能需要删除 node_modules 文件夹并再次 运行 npm install