Laravel-即使需要PHP版本,也无法安装软件包

时间:2019-08-05 16:12:58

标签: php laravel version mamp-pro

我在项目上安装一些作曲家软件包时遇到问题。

Problem 1
    - Installation request for spatie/image-optimizer 1.1.5 -> satisfiable by spatie/image-optimizer[1.1.5].
    - spatie/image-optimizer 1.1.5 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
  Problem 2
    - Installation request for spatie/laravel-feed 2.2.1 -> satisfiable by spatie/laravel-feed[2.2.1].
    - spatie/laravel-feed 2.2.1 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
  Problem 3
    - Installation request for spatie/laravel-newsletter 4.5.0 -> satisfiable by spatie/laravel-newsletter[4.5.0].
    - spatie/laravel-newsletter 4.5.0 requires php ~7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
  Problem 4
    - Installation request for spatie/laravel-referer 1.4.0 -> satisfiable by spatie/laravel-referer[1.4.0].
    - spatie/laravel-referer 1.4.0 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
  Problem 5
    - Installation request for spatie/laravel-sitemap 5.3.0 -> satisfiable by spatie/laravel-sitemap[5.3.0].
    - spatie/laravel-sitemap 5.3.0 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
  Problem 6
    - spatie/image-optimizer 1.1.5 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
    - spatie/image 1.7.2 requires spatie/image-optimizer ^1.0 -> satisfiable by spatie/image-optimizer[1.1.5].
    - Installation request for spatie/image 1.7.2 -> satisfiable by spatie/image[1.7.2].

即使我的PHP版本是7.2.1,这些软件包也没有通过composer.json验证,即无法安装。 PHP CLI版本也是7.2.1。 (已使用标准过程phpinfo()php -v进行了全部检查。

我正在使用MAMP PRO版本4.4.1,并且列出的版本中最新的可配置PHP版本是7.2.1(这是可以的,因为这些软件包的要求范围是7.1到{{ 1}}。

https://github.com/spatie/image-optimizer/blob/master/composer.json#L19

https://github.com/spatie/laravel-newsletter/blob/master/composer.json#L20

https://github.com/spatie/laravel-feed/blob/master/composer.json#L33

https://github.com/spatie/laravel-referer/blob/master/composer.json#L19

https://github.com/spatie/laravel-sitemap/blob/master/composer.json#L19

正如我已经说过的那样,PHP版本在Apache端和CLI端以及MAMP PRO GUI上都看起来不错。

7.2

MAMP PRO配置:

MAMP PRO general config 1

与MAMP PRO主机相关的配置:

MAMP PRO individual config 2

将PHP升级到版本 7.3 可能会解决此问题,但我想跳过这一点,因为它必须在没有MAMP PRO的帮助下手动完成(因为我的MAMP PRO版本已获得许可,并且我需要另外的许可才能获得内置的PHP版本。

谢谢!

1 个答案:

答案 0 :(得分:1)

除了您的composer.json中的a custom version defined外,不确定是什么原因造成的:

{
    "config": {
        "platform": {
            "php": "7.1.14"
        }
    },

要变通解决此问题,您可以告诉作曲家忽略该版本:

composer require spatie/image-optimizer --ignore-platform-reqs