npm WARN react-native-maps@0.14.0需要react @> = 15.4.0的同行,但没有安装 [英] npm WARN react-native-maps@0.14.0 requires a peer of react@>=15.4.0 but none was installed

查看:446
本文介绍了npm WARN react-native-maps@0.14.0需要react @> = 15.4.0的同行,但没有安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过Airbnb在我的项目中安装react-native-maps。 安装说明:
airbnb / react-native- maps / installation


当我在cmd中运行以下命令时: npm install react-native-maps --save $ b

这是我得到的:
` - react-native-maps@0.14.0
npm WARN react-native-maps@0.14.0需要react @> = 15.4.0,但没有安装。



如果我继续处理进一步安装,然后运行以下命令: react-native link react-native-maps



这就是我get:
扫描C:\RNProjects\Mapp\\\
ode_modules(39ms)中的符号链接561文件夹
rnpm-install info链接react-native-maps ios依赖项
rnpm -install info iOS模块react-native-maps已成功链接



^正如我们所看到的,只有iOS相关的地图模块才会被安装。在检查项目目录时,我能够验证是否安装了与Android相关的模块。



疑难解答



以下是我尝试解决此问题的列表,但它们都无效。


  1. 尝试安装 npm install react@15.4.0 --save

得到以下警告: / p>

npm WARN react-native@0.43.3需要react@16.0.0-alpha.6的同伴,但没有安装。
npm WARN react-test-renderer@16.0.0-alpha.6需要react@^16.0.0-alpha.6的同伴,但没有安装。


因此,为了解决这个问题,我尝试安装react@16.0.0-alpha.6: npm install react@16.0.0-alpha.6

我再次收到同样的消息:
$ b $ npm WARN react-native- maps@0.14.0需要react @> = 15.4.0,但没有安装。


  1. 尝试更新react-native npm update react-native

Still获得相同的警告信息。


  1. 尝试安装最新版本的npm: npm install npm @latest -g

无法使用。

其他信息


  • react-native:0.43.3
  • react-native-cli:2.0.1

  • 平台:Android

  • 开发操作系统:Windows 10 OS


解决方案

下面是我能够解决这个问题的方法(时间顺序) p>


  1. 从项目中删除 node_module 目录
  2. npm cache clean

  3. 修改了package.json,内容如下:react:〜15.4.1; 反应天然:0.42.3; react-test-renderer:15.4.1

  4. npm install all module

  5. npm install

  6. npm i react-native-maps@0.12.5 - -S

  7. react-native link react-native-maps

一旦我这样做,它就能成功地将android和ios react-native-modules 链接到项目中。


$ b 注意:在运行 react-native run-android 命令之前,



运行: cd android&& gradlew clean&& cd ..&& react-native run-android



这会在运行前清理gradle,并帮助避免任何错误。 b

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: `-- react-native-maps@0.14.0 npm WARN react-native-maps@0.14.0 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 react@15.4.0 --save

Got these warnings:

npm WARN react-native@0.43.3 requires a peer of react@16.0.0-alpha.6 but none was installed. npm WARN react-test-renderer@16.0.0-alpha.6 requires a peer of react@^16.0.0-alpha.6 but none was installed.

So, in order to resolve this, I tried installing react@16.0.0-alpha.6 with: npm install react@16.0.0-alpha.6.

I got the same message again:

npm WARN react-native-maps@0.14.0 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

解决方案

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 react-native-maps@0.12.5 --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.

这篇关于npm WARN react-native-maps@0.14.0需要react @> = 15.4.0的同行,但没有安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆