0

我无法安装组件,因为我收到此错误:

npm install react-native-side-menu
Rdemo@0.0.1 /home/mss/Desktop/cakenew25_aug/MagentoLatest/Rdemo
+-- UNMET PEER DEPENDENCY react@16.0.0-alpha.6
`-- react-native-side-menu@0.20.1 

npm WARN react-native-selectbox@0.1.2 requires a peer of react@>15.0 but none was installed.
npm WARN react-static-container@1.0.1 requires a peer of react@^0.13.0 || ^0.14.0 || ^15.0.0 but none was installed.

我正在尝试在我的反应原生演示中实现侧边菜单。我是这个平台的新手和自学者。在这个演示中使用 react-native-router-flux 架构。

我从下面的链接中获得了侧面菜单实施的示例:-

https://reacttuts.blogspot.in/2016/06/side-menu-component-for-react-native.html?showComment=1496152015774#c5969922046557572516

我尝试了以下命令来消除此错误,但没有成功:-

npm install npm@latest -g
npm prune
npm install --save react@16.0.0-alpha.6

反应本机版本信息:-

react-native-cli: 2.0.1
react-native: 0.44.0

这是我的 Package.json :-

{
  "name": "Rdemo",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "^16.0.0-alpha.6",
    "react-native": "0.44.0",
    "react-native-check-box": "^1.0.4",
    "react-native-drawer": "^2.3.0",
    "react-native-easy-toast": "^1.0.6",
    "react-native-flexi-radio-button": "^0.2.0",
    "react-native-router-flux": "^3.38.0",
    "react-native-selectbox": "^0.1.2",
    "react-native-vector-icons": "^4.1.1",
    "react-native-web-service-handler": "^1.0.2"
  },
  "devDependencies": {
    "babel-jest": "20.0.3",
    "babel-preset-react-native": "1.9.2",
    "jest": "20.0.3",
    "react-test-renderer": "16.0.0-alpha.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

npm 详细信息:-

npm list --depth=0
Rdemo@0.0.1 /home/mss/Desktop/cakenew25_aug/MagentoLatest/Rdemo
+-- babel-jest@20.0.3
+-- babel-preset-react-native@1.9.2
+-- jest@20.0.3
+-- UNMET PEER DEPENDENCY react@16.0.0-alpha.6
+-- react-native@0.44.0
+-- react-native-check-box@1.0.4
+-- react-native-drawer@2.3.0
+-- react-native-easy-toast@1.0.6
+-- react-native-flexi-radio-button@0.2.0
+-- react-native-router-flux@3.39.2
+-- react-native-selectbox@0.1.2
+-- react-native-vector-icons@4.2.0
+-- react-native-web-service-handler@1.0.2
`-- react-test-renderer@16.0.0-alpha.6

npm ERR! peer dep missing: react@>15.0, required by react-native-selectbox@0.1.2
npm ERR! peer dep missing: react@^0.13.0 || ^0.14.0 || ^15.0.0, required by react-static-container@1.0.1


Node version :- v6.9.1
npm version :- v3.10.8

这是我的错误的屏幕截图:-

在此处输入图像描述

任何帮助,谢谢

4

2 回答 2

1

react-native-side-menu 需要 react 16.0.0-alpha.6 才能工作。执行此操作,在位于根目录的项目文件夹中找到package.json文件。打开它并找到反应(在依赖项字典中),将值编辑为“16.0.0-alpha.6”,保存然后

rm -rf node_modules/
npm install --save

这将安装 package.json 中的所有依赖项,现在将安装所需的 react 版本。此过程可用于任何包。

在此处输入图像描述

在此处输入图像描述

于 2017-05-31T05:14:35.610 回答
0

您是否尝试过使用 sudo 安装。我认为这是一种许可问题。

于 2017-05-31T11:27:41.133 回答