无法解析模块react-native-navbar

时间:2017-05-31 04:38:09

标签: android react-native react-native-router-flux side-menu

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

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

以下是我的错误的屏幕截图: -

enter image description here

任何帮助, 感谢

2 个答案:

答案 0 :(得分:1)

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

rm -rf node_modules/
npm install --save

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

enter image description here

enter image description here

答案 1 :(得分:0)

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