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
问题描述
airbnb / react-native- maps / installation
当我在cmd中运行以下命令时: 这是我得到的: 如果我继续处理进一步安装,然后运行以下命令: 这就是我get: ^正如我们所看到的,只有iOS相关的地图模块才会被安装。在检查项目目录时,我能够验证是否安装了与Android相关的模块。 疑难解答 以下是我尝试解决此问题的列表,但它们都无效。 得到以下警告: / p> npm WARN react-native@0.43.3需要react@16.0.0-alpha.6的同伴,但没有安装。 因此,为了解决这个问题,我尝试安装react@16.0.0-alpha.6: 我再次收到同样的消息: Still获得相同的警告信息。 无法使用。 其他信息 下面是我能够解决这个问题的方法(时间顺序) p> 一旦我这样做,它就能成功地将android和ios react-native-modules 链接到项目中。 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
扫描C:\RNProjects\Mapp\\\
ode_modules(39ms)中的符号链接561文件夹
rnpm-install info链接react-native-maps ios依赖项
rnpm -install info iOS模块react-native-maps已成功链接
npm install react@15.4.0 --save
npm WARN react-test-renderer@16.0.0-alpha.6需要react@^16.0.0-alpha.6的同伴,但没有安装。
npm install react@16.0.0-alpha.6 $ c
$ b $
npm update react-native
。
npm install npm @latest -g
。
npm cache clean
npm install all module
npm install
npm i react-native-maps@0.12.5 - -S
react-native link react-native-maps
$ 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.
- 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.
- Tried updating react-native
npm update react-native
.
Still getting the same warning message.
- 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):
- Deleted node_module directory from the project
npm cache clean
- Modified package.json with: "react":"~15.4.1"; "react-native":"0.42.3"; "react-test-renderer":"15.4.1"
npm install all module
npm install
npm i react-native-maps@0.12.5 --S
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屋!