【问题标题】:I'm trying to install maatwebsite/excel package to my laravel with but got this error我正在尝试将 maatwebsite/excel 包安装到我的 laravel,但出现此错误
【发布时间】:2022-01-25 21:05:52
【问题描述】:

我正在尝试使用此命令将 maatwebsite/excel 包安装到我的 laravel

composer require maatwebsite/excel

但我收到了这条错误消息:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - maatwebsite/excel[3.1.28, ..., 3.1.30] require phpoffice/phpspreadsheet 1.16.* -> satisfiable by phpoffice/phpspreadsheet[1.16.0].
    - maatwebsite/excel[3.1.31, ..., 3.1.x-dev] require phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, 1.19.0, 1.20.0].
    - maatwebsite/excel 3.1.27 requires phpoffice/phpspreadsheet ^1.16 -> satisfiable by phpoffice/phpspreadsheet[1.16.0, ..., 1.20.0].
    - maatwebsite/excel 3.1.26 requires phpoffice/phpspreadsheet ^1.15 -> satisfiable by phpoffice/phpspreadsheet[1.15.0, ..., 1.20.0].
equirement.
    - phpoffice/phpspreadsheet[1.15.0, ..., 1.20.0] require ext-gd * -> it is missing from your system. Install 
or enable PHP's gd extension.
    - Root composer.json requires maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, ..., 3.1.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
    - C:\xampp\php\php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-gd` to temporarily ignore these required extensions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require maatwebsite/excel:*" to figure out if any version is installable, or "composer require maatwebsite/excel:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

我正在使用: 作曲家 2.2.1 版 PHP 版本 8.0.1 laravel 8.68.1

这是什么原因造成的???

【问题讨论】:

  • 如消息所述,您的系统缺少该软件包所需的 php-gd 扩展名。安装php-gd 并重试。

标签: php json excel laravel docker-compose


【解决方案1】:

抛出的错误也为您提供了解决方案,扩展程序需要一些缺少的包,只需单独安装它们或允许 composer 使用此行自动安装所有:

composer require maatwebsite/excel:*

【讨论】:

    猜你喜欢
    • 2022-06-16
    • 2022-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-23
    • 2023-02-14
    • 2020-02-26
    相关资源
    最近更新 更多