Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed

Problem

I'm trying to install react-native-maps by Airbnb in my project. Installation instructions: airbnb/react-native-maps/installation

When I run the following command in cmd: npm install react-native-maps --save

This is what I get: `-- [email protected] npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed.

Ignoring this if I proceed with further installation, and run the following command: react-native link react-native-maps

This is what I get: Scanning 561 folders for symlinks in C:\RNProjects\Mapp\node_modules (39ms) rnpm-install info Linking react-native-maps ios dependency rnpm-install info iOS module react-native-maps has been successfully linked

^As we can see, only iOS related maps modules get installed. On checking the project directory, I was able to validate that no android related module was installed.

Troubleshooting

Here's the list of thing I tried to resolve the issue, but none of them worked.

  1. Tried installing npm install [email protected] --save

Got these warnings:

npm WARN [email protected] requires a peer of [email protected] but none was installed. npm WARN [email protected] requires a peer of react@^16.0.0-alpha.6 but none was installed.

So, in order to resolve this, I tried installing [email protected] with: npm install [email protected].

I got the same message again:

npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed.

  1. Tried updating react-native npm update react-native.

Still getting the same warning message.

  1. Tried installing the latest version of npm: npm install npm@latest -g.

Didn't work.

Additional Information

  • react-native: 0.43.3
  • react-native-cli: 2.0.1
  • Platform: Android
  • Development Operating System: Windows 10 OS
like image 483
prasang7 Avatar asked Apr 13 '17 23:04

prasang7


2 Answers

Here's how I was able to solve this (chronological order):

  1. Deleted node_module directory from the project
  2. npm cache clean
  3. Modified package.json with: "react":"~15.4.1"; "react-native":"0.42.3"; "react-test-renderer":"15.4.1"
  4. npm install all module
  5. npm install
  6. npm i [email protected] --S
  7. react-native link react-native-maps

Once I do this, it's successfully able to link the android and ios react-native-modules to the project.

Note: Before running the react-native run-android command,

Run: cd android && gradlew clean && cd .. && react-native run-android.

This will clean the gradle before running and help in avoiding any errors.

like image 67
prasang7 Avatar answered Sep 27 '22 20:09

prasang7


You can try:

  1. delete node_module, npm cache clean;
  2. modify package.json

    "react": "~15.4.1","react-native": "0.42.3","react-test-renderer": "~15.4.1",

  3. npm install all module;

  4. done ;)

like image 38
philions Avatar answered Sep 27 '22 20:09

philions