反应&安装material-ui时,React-Native版本会发生冲突

时间:2016-05-26 07:45:18

标签: reactjs react-native material-ui

我正在尝试在新的React-Native项目上安装material-ui,该项目运行 react-native:0.26.2 & 反应:“15.0.2 。 当我安装了材料-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构建,似乎存在版本冲突。

有没有人意识到我能做些什么?

1 个答案:

答案 0 :(得分:0)

我使用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