安装 GeoIP2 时出错:geoip2/geoip2 v2.3.1 需要 maxmind/web-service-common

Posted

技术标签:

【中文标题】安装 GeoIP2 时出错:geoip2/geoip2 v2.3.1 需要 maxmind/web-service-common【英文标题】:Error installing GeoIP2: geoip2/geoip2 v2.3.1 requires maxmind/web-service-common 【发布时间】:2016-05-19 07:38:57 【问题描述】:

我在尝试安装 GeoIP2 时遇到此错误。不幸的是,错误消息不是很容易谷歌搜索,我不知道如何修复它。很明显,缺少一些东西,但我不确定是什么。我对作曲家不是很有经验。谁能帮我破译这个错误吗?

$ composer require "geoip2/geoip2":"~2.0"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - geoip2/geoip2 v2.3.1 requires maxmind/web-service-common ~0.0.3 -> satisfiable by maxmind/web-service-common[v0.0.3, v0.0.4].
    - geoip2/geoip2 v2.3.2 requires maxmind/web-service-common ~0.0.3 -> satisfiable by maxmind/web-service-common[v0.0.3, v0.0.4].
    - geoip2/geoip2 v2.3.3 requires maxmind/web-service-common ~0.0.3 -> satisfiable by maxmind/web-service-common[v0.0.3, v0.0.4].
    - geoip2/geoip2 v2.4.0 requires maxmind/web-service-common ~0.0.3 -> satisfiable by maxmind/web-service-common[v0.0.3, v0.0.4].
    - geoip2/geoip2 v2.3.0 requires maxmind/web-service-common ~0.0.2 -> satisfiable by maxmind/web-service-common[v0.0.2, v0.0.3, v0.0.4].
    - geoip2/geoip2 v2.0.0 requires guzzle/guzzle 3.* -> satisfiable by guzzle/guzzle[v3.0.0, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.1.0, v3.1.1, v3.1.2, v3.2.0, v3.3.0, v3.3.1, v3.4.0, v3.4.1, v3.4.2, v3.4.3, v3.5.0, v3.6.0, v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2, v3.9.3].
    - geoip2/geoip2 v2.1.0 requires guzzle/guzzle 3.* -> satisfiable by guzzle/guzzle[v3.0.0, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.1.0, v3.1.1, v3.1.2, v3.2.0, v3.3.0, v3.3.1, v3.4.0, v3.4.1, v3.4.2, v3.4.3, v3.5.0, v3.6.0, v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2, v3.9.3].
    - geoip2/geoip2 v2.1.1 requires guzzle/guzzle 3.* -> satisfiable by guzzle/guzzle[v3.0.0, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.1.0, v3.1.1, v3.1.2, v3.2.0, v3.3.0, v3.3.1, v3.4.0, v3.4.1, v3.4.2, v3.4.3, v3.5.0, v3.6.0, v3.7.0, v3.7.1, v3.7.2, v3.7.3, v3.7.4, v3.8.0, v3.8.1, v3.9.0, v3.9.1, v3.9.2, v3.9.3].
    - maxmind/web-service-common v0.0.4 requires ext-curl * -> the requested php extension curl is missing from your system.
    - maxmind/web-service-common v0.0.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - maxmind/web-service-common v0.0.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.9.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.9.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.9.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.9.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.8.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.8.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.7.4 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.7.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.7.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.7.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.7.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.6.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.5.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.4.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.4.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.4.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.4.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.3.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.3.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.2.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.1.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.1.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.1.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.0.7 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.0.6 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.0.5 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.0.4 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.0.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.0.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.0.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - guzzle/guzzle v3.0.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - Installation request for geoip2/geoip2 ~2.0 -> satisfiable by geoip2/geoip2[v2.0.0, v2.1.0, v2.1.1, v2.3.0, v2.3.1, v2.3.2, v2.3.3, v2.4.0].

  To enable extensions, verify that they are enabled in those .ini files:
    - C:\PHP\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

【问题讨论】:

在安装geoip之前运行'composer update',然后将require添加到composer.json并再次运行更新 @stig-js 谢谢你的建议。我做了所有这些,但在第二次运行更新时遇到了同样的错误 【参考方案1】:

是的,只要安装cURL,就会成功安装 对于带有 php5 的 Ubuntu: sudo apt-get install php5-curl

对于带有 php7 的 Ubuntu:sudo apt-get install php7.0-curl

对于带有 php7.4 的 Ubuntu:sudo apt-get install php7.4-curl

【讨论】:

【参考方案2】:

以防万一有人偶然发现同样的问题......

解决方案是在php.ini 文件中启用curl 扩展,如错误消息的最后部分所示:

To enable extensions, verify that they are enabled in those .ini files:
    - C:\PHP\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

我刚刚从 ;extension=php_curl.dll 中删除了分号,它起作用了。

我还需要最新版本的 GeoID(不是 github 文档建议的 2.0):

composer require geoip2/geoip2:~2.4.0

【讨论】:

以上是关于安装 GeoIP2 时出错:geoip2/geoip2 v2.3.1 需要 maxmind/web-service-common的主要内容,如果未能解决你的问题,请参考以下文章

在 GeoIP2 中找不到阅读器类

客户端灰度发布,NGINX+GeoIP2+GeoIP Database

GeoIP2 MaxMind pom 和我本地的有啥区别?

GeoIp2 数据库读取问题,我是在eclipse上编写的java jdk是7,生成DatabaseReader实例时报错

使用 maxmind geoip2 呼出城市名称

如何修复在 Hive 下运行的 geoip2 java 的“java.lang.NoSuchMethodError”