【问题标题】:Laravel maatwebsite/excel composer install error in macLaravel maatwebsite/excel composer在mac中安装错误
【发布时间】:2019-10-11 06:03:28
【问题描述】:

尝试通过 composer for mac 在 XAMPP 7.1.32 rev 1 中安装 maatwebsite/excel。 如何在 XAMPP for mac 中启用这些扩展,或者还有其他问题。请帮帮我。

composer install
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
    - maatwebsite/excel 3.1.10 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.11 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.12 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.13 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.14 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.15 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.16 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.17 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.7 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.8 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.9 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.0 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.1 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.2 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.3 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.4 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.5 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.6 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - phpoffice/phpspreadsheet 1.9.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.8.2 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.8.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.8.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.7.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.6.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.5.2 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.5.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.5.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.4.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - Installation request for maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, 3.1.1, 3.1.10, 3.1.11, 3.1.12, 3.1.13, 3.1.14, 3.1.15, 3.1.16, 3.1.17, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.8, 3.1.9].

在我的 php 信息中启用了 zip。

【问题讨论】:

  • 如果工作,你会访问 - stackoverflow.com/questions/48240726/…
  • 到目前为止你尝试过什么?你被困在哪里了? PHP 的 CLI 版本和您的网络服务器的模块共享它们的配置是很常见的

标签: php laravel maatwebsite-excel


【解决方案1】:

当您从命令行运行 composer 时,您不太可能使用 XAMPP 用于运行您的网站的同一版本的 PHP,这可能是它在此处报告缺少 zip 问题的原因。

最简单的解决方法是在安装过程中通过运行 composer install --ignore-platform-reqs 忽略平台要求(在本例中为 ext-zip)。

【讨论】:

  • 这对我有用。谢谢!!
【解决方案2】:

请你跑:

composer require phpoffice/phpspreadsheet

如果phpspreadsheet 已安装。然后,升级composer.json中的版本。只需将现有版本替换为兼容版本即可。例如,替换为:
"phpoffice/phpspreadsheet": "^1.9",

然后运行composer update
更多详情phpspreadsheet
另外,通过php -m 检查zip 模块是否存在。如果,您在那里找不到zip 模块。你必须安装它,你的错误已经说,它在你的系统中不存在 - visit

【讨论】:

  • 工作正常.. 需要重新安装带有 zip 扩展名的 php cli。
  • 请分享更多细节。由于maatwebsite/excel 需要该软件包,因此无需手动要求它。如果 ZIP 扩展丢失,要求任何需要此扩展的包应该仍然无法工作
【解决方案3】:

如果上述解决方案都不起作用,请使用此

Yajra/Datatables 安装问题 phpoffice/phpspreadsheet 1.9.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.

brew update
brew install php@7.3
brew link php@7.3 --force

【讨论】:

    【解决方案4】:

    我刚刚运行了以下命令,它对我有用。

    因为我在我的 ubuntu 系统上安装了 php 7.3,所以我运行了这个命令。

    sudo apt-get install php7.3-zip
    

    【讨论】:

      【解决方案5】:

      “extension=gd”在 php.ini 中被注释了,你只是那一行 Out of Comment 问题解决了!!!

      【讨论】:

      • phpoffice/phpspreadsheet 1.9.0 requires ext-zip - 无法通过启用 gd 扩展来解决
      【解决方案6】:

      错误提示需要phpoffice/phpspreadsheet ^ 1.6

      添加到composer.json 文件:

      "require": {
              "phpoffice/phpspreadsheet": "^1.9"
          },
      

      之后,在命令提示符下运行这个命令:composer update

      要安装最新版本phpoffice/phpspreadsheet,请运行以下命令

      composer require phpoffice/phpspreadsheet
      

      更多信息:phpoffice/phpspreadsheet | maatwebsite/excel

      【讨论】:

      • 这个错误是因为php cli版本缺少zip扩展。
      • 请分享更多细节。由于maatwebsite/excel 需要该软件包,因此无需手动要求它。如果 ZIP 扩展丢失,要求任何需要此扩展的包应该仍然无法工作
      猜你喜欢
      • 1970-01-01
      • 2014-09-18
      • 2016-07-15
      • 2014-12-07
      • 2022-06-16
      • 2017-01-12
      • 1970-01-01
      • 2021-02-19
      • 2018-10-29
      相关资源
      最近更新 更多