【问题标题】:React & React-Native versions conflict while installing material-ui安装 material-ui 时 React 和 React-Native 版本冲突
【发布时间】:2016-05-26 07:45:18
【问题描述】:

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

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

【问题讨论】:

    标签: reactjs react-native material-ui


    【解决方案1】:

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

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

    这是我的package.json 文件:

    { "name": "AwesomeProject", “版本”:“0.0.1”, “私人”:真的, “脚本”:{ “开始”:“节点 node_modules/react-native/local-cli/cli.js 开始” }, “依赖”:{ “反应”:“^15.0.2”, “反应原生”:“^0.26.2”, “反应原生材料设计”:“^0.3.6” } }

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

    【讨论】:

      猜你喜欢
      • 2017-12-08
      • 1970-01-01
      • 2022-12-16
      • 2016-09-20
      • 1970-01-01
      • 2017-12-11
      • 2016-01-09
      • 2019-09-01
      • 2023-03-22
      相关资源
      最近更新 更多