0

I am not able to install the component cause I get this error:

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.

I am trying to implement side menu in my react native demo. I am newbie to this platform and self learner. i am using react-native-router-flux architecture in this demo.

i got example for side menu implementation from below link :-

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

I tried following commands to get rid of this error , but no success :-

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

React native version info :-

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

Here is my 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 detail :-

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

Here is the screenshot of my error :-

enter image description here

Any Help , Thanks

user2028
  • 163
  • 4
  • 15
  • 40

2 Answers2

1

react-native-side-menu require react 16.0.0-alpha.6 to work. Do this, find the package.json file in your project folder located in the root directory. open it and find react (in the dependencies dictionary), edit the value to "16.0.0-alpha.6", save it and then

rm -rf node_modules/
npm install --save

this will install all the dependencies found in your package.json, and now the required react version will be installed. This procedure can be used for any package.

enter image description here

enter image description here

BK7
  • 1,161
  • 9
  • 15
  • it's not able to find the module in your project directory, may be this is because the package got installed globally, do this, go to your project directory, remove all node modules and then npm install --save. and from your project folder, react-native run-android. Let me know what output you get – BK7 May 31 '17 at 05:45
  • should i remove node module folder ? or the folders inside it ? – user2028 May 31 '17 at 05:47
  • the entire node module folder, do rm -rf node_modules/ from your root directory, it'll do the job – BK7 May 31 '17 at 05:52
  • Still getting same issue , i run both the commands rm -rf node_modules/ and then npm install --save. – user2028 May 31 '17 at 06:30
  • Okay, may be the library didn't get linked properly. try react-native link react-native-side-menu – BK7 May 31 '17 at 06:45
  • I don't think so.. what happened when you tried to link? did it link successfully? – BK7 May 31 '17 at 06:48
  • i got this :- Scanning 571 folders for symlinks in /home/mss/Desktop/cakenew25_aug/MagentoLatest/Rdemo/node_modules (5ms) { Error: Cannot find module '/home/mss/Desktop/cakenew25_aug/MagentoLatest/Rdemo/node_modules/react-native-side-menu/package.json' – user2028 May 31 '17 at 06:49
  • was not able to find module – user2028 May 31 '17 at 06:50
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/145514/discussion-between-bk7-and-siddharth). – BK7 May 31 '17 at 06:53
0

Have you tried with to install with sudo. I think its a kind of permission issue.

Anuj Kumar
  • 160
  • 1
  • 2
  • 11