Laravel 没有安装依赖项不正确的 php 版本

Posted

技术标签:

【中文标题】Laravel 没有安装依赖项不正确的 php 版本【英文标题】:Laravel not installing dependencies incorrect php version 【发布时间】:2017-05-15 04:01:06 【问题描述】:

由于 php 版本,我无法安装所有 laravel 依赖项,但我使用 xampp 和 (PHP 7.0.13) 使用 echo phpversion(); 来确定我的 php 版本,但是这个 laravel 一直告诉我我正在使用 php 版本5.4.24 当我安装新的 laravel 目录时。

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\User>cd C:\xampp

C:\xampp>laravel new htdocs
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - This package requires php >=5.6.4 but your PHP version (5.4.24) does not satisfy that requirement.
  Problem 2
    - Installation request for classpreloader/classpreloader 3.1.0 -> satisfiable by classpreloader/classpreloader[3.1.0].
    - classpreloader/classpreloader 3.1.0 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 3
    - Installation request for laravel/framework v5.3.28 -> satisfiable by laravel/framework[v5.3.28].
    - laravel/framework v5.3.28 requires php >=5.6.4 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 4
    - Installation request for league/flysystem 1.0.32 -> satisfiable by league/flysystem[1.0.32].
    - league/flysystem 1.0.32 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 5
    - Installation request for nikic/php-parser v3.0.2 -> satisfiable by nikic/php-parser[v3.0.2].
    - nikic/php-parser v3.0.2 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 6
    - Installation request for symfony/console v3.1.8 -> satisfiable by symfony/console[v3.1.8].
    - symfony/console v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 7
    - Installation request for symfony/debug v3.1.8 -> satisfiable by symfony/debug[v3.1.8].
    - symfony/debug v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 8
    - Installation request for symfony/event-dispatcher v3.2.1 -> satisfiable by symfony/event-dispatcher[v3.2.1].
    - symfony/event-dispatcher v3.2.1 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 9
    - Installation request for symfony/finder v3.1.8 -> satisfiable by symfony/finder[v3.1.8].
    - symfony/finder v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 10
    - Installation request for symfony/http-foundation v3.1.8 -> satisfiable by symfony/http-foundation[v3.1.8].
    - symfony/http-foundation v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 11
    - Installation request for symfony/http-kernel v3.1.8 -> satisfiable by symfony/http-kernel[v3.1.8].
    - symfony/http-kernel v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 12
    - Installation request for symfony/process v3.1.8 -> satisfiable by symfony/process[v3.1.8].
    - symfony/process v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 13
    - Installation request for symfony/routing v3.1.8 -> satisfiable by symfony/routing[v3.1.8].
    - symfony/routing v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 14
    - Installation request for symfony/translation v3.1.8 -> satisfiable by symfony/translation[v3.1.8].
    - symfony/translation v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 15
    - Installation request for symfony/var-dumper v3.1.8 -> satisfiable by symfony/var-dumper[v3.1.8].
    - symfony/var-dumper v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 16
    - Installation request for phpdocumentor/reflection-common 1.0 -> satisfiable by phpdocumentor/reflection-common[1.0].
    - phpdocumentor/reflection-common 1.0 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 17
    - Installation request for phpdocumentor/reflection-docblock 3.1.1 -> satisfiable by phpdocumentor/reflection-docblock[3.1.1].
    - phpdocumentor/reflection-docblock 3.1.1 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 18
    - Installation request for phpdocumentor/type-resolver 0.2.1 -> satisfiable by phpdocumentor/type-resolver[0.2.1].
    - phpdocumentor/type-resolver 0.2.1 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 19
    - Installation request for phpunit/php-code-coverage 4.0.4 -> satisfiable by phpunit/php-code-coverage[4.0.4].
    - phpunit/php-code-coverage 4.0.4 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 20
    - Installation request for phpunit/phpunit 5.7.5 -> satisfiable by phpunit/phpunit[5.7.5].
    - phpunit/phpunit 5.7.5 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 21
    - Installation request for phpunit/phpunit-mock-objects 3.4.3 -> satisfiable by phpunit/phpunit-mock-objects[3.4.3].
    - phpunit/phpunit-mock-objects 3.4.3 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 22
    - Installation request for sebastian/code-unit-reverse-lookup 1.0.0 -> satisfiable by sebastian/code-unit-reverse-lookup[1.0.0].
    - sebastian/code-unit-reverse-lookup 1.0.0 requires php >=5.6 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 23
    - Installation request for sebastian/environment 2.0.0 -> satisfiable by sebastian/environment[2.0.0].
    - sebastian/environment 2.0.0 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 24
    - Installation request for sebastian/object-enumerator 2.0.0 -> satisfiable by sebastian/object-enumerator[2.0.0].
    - sebastian/object-enumerator 2.0.0 requires php >=5.6 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 25
    - Installation request for sebastian/resource-operations 1.0.0 -> satisfiable by sebastian/resource-operations[1.0.0].
    - sebastian/resource-operations 1.0.0 requires php >=5.6.0 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 26
    - Installation request for sebastian/version 2.0.1 -> satisfiable by sebastian/version[2.0.1].
    - sebastian/version 2.0.1 requires php >=5.6 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 27
    - Installation request for symfony/css-selector v3.1.8 -> satisfiable by symfony/css-selector[v3.1.8].
    - symfony/css-selector v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 28
    - Installation request for symfony/dom-crawler v3.1.8 -> satisfiable by symfony/dom-crawler[v3.1.8].
    - symfony/dom-crawler v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 29
    - Installation request for symfony/yaml v3.2.1 -> satisfiable by symfony/yaml[v3.2.1].
    - symfony/yaml v3.2.1 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
  Problem 30
    - nikic/php-parser v3.0.2 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
    - psy/psysh v0.8.0 requires nikic/php-parser ~1.3|~2.0|~3.0 -> satisfiable by nikic/php-parser[v3.0.2].
    - Installation request for psy/psysh v0.8.0 -> satisfiable by psy/psysh[v0.8.0].

Application ready! Build something amazing.

C:\xampp>

【问题讨论】:

检查您的 PHP 版本 我已经用“echo phpversion()”检查过了,它显示 7.0.13 Change PHP version used by Composer on Windows的可能重复 【参考方案1】:

你需要做两件事之一。

解决方案 1 - 您需要更新您的 PHP 版本。如果您没有正确的版本,Laravel 将无法正常运行。

解决方案 2 - 也许您有正确的 PHP 版本,但由于某种原因,composer 看不到。轻松修复,您只需要使用--ignore-platform-reqs 命令。无论 PHP 版本如何,这将允许您使用 composer 安装东西。

【讨论】:

【参考方案2】:

我刚才遇到了这个问题,我通过将路径环境变量从操作系统更改为指向包含最新 php 版本的 wamp php 文件夹来修复它。 为了做到这一点(我也必须研究这个) - 我去了这个链接并按照说明操作:https://www.java.com/en/download/help/path.xml

旧的 Path 变量如下所示:C:\wamp64\bin\php\php5.6.25 我将其更改为 C:\wamp64\bin\php\php7.0.10 保存所有内容,关闭所有内容,重新启动我的电脑,然后它就没有问题了。 希望这可以为某人节省一些研究时间。

【讨论】:

【参考方案3】:

已经解决了。看来我的系统正在使用 IIS Express 的另一个 php 版本,它使用旧版本的 php。我只是将环境变量更改为指向具有最新 php 版本的 xampp php

【讨论】:

以上是关于Laravel 没有安装依赖项不正确的 php 版本的主要内容,如果未能解决你的问题,请参考以下文章

Windows下Composer依赖控制器下载纯净版laravel

通过 Grab 添加的外部库的可选依赖项不可用

搜索依赖项不返回任何内容

为啥依赖项不包含在 JAR 文件中? [复制]

如何安装Laravel框架

Laravel下载安装—使用Composer安装(Windows版)