安装maatwebsite/excel失败

问题描述 投票:0回答:3

所以我想安装maatwebsite/excel,并且我尝试了几种方法但没有成功。有人能帮我吗。我使用 laravel v 9 和 php v 8.1

> Gymnastiar@LAPTOP-NEA31346 MINGW64
> ~/Documents/Gymnastiar/Project/YamahaL8 $ composer require
> maatwebsite/excel Using version ^3.1 for maatwebsite/excel
> ./composer.json has been updated Running composer update
> maatwebsite/excel Loading composer repositories with package
> information Updating dependencies 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.24.0].
>     - maatwebsite/excel 3.1.27 requires phpoffice/phpspreadsheet ^1.16 -> satisfiable by phpoffice/phpspreadsheet[1.16.0, ..., 1.24.0].
>     - maatwebsite/excel 3.1.26 requires phpoffice/phpspreadsheet ^1.15 -> satisfiable by phpoffice/phpspreadsheet[1.15.0, ..., 1.24.0].
>     - maatwebsite/excel[3.1.0, ..., 3.1.25] require php ^7.0 -> your php version (8.1.6) does not satisfy that requirement.
>     - phpoffice/phpspreadsheet[1.15.0, ..., 1.24.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 ne
php laravel composer-php maatwebsite-excel
3个回答
9
投票
  1. 转到
    C:\xampp\php
  2. 中的 php.ini 文件
  3. 搜索这个
    ;extension=gd
  4. 删除
    ;
    然后重新启动xampp
  5. "maatwebsite/excel": "^3.0"
    添加到
    "require"
    文件中的
    composer.json
  6. 奔跑
    composer update maatwebsite/excel

更新:如果您在 Ubuntu-Debian 操作系统上遇到此问题,只需执行此命令即可安装 php-gd 扩展:

sudo apt-get install php8.1-gd // for php8.1
sudo apt-get install php8.2-gd // for php8.2

3
投票
  1. 首先在项目的 composer.json 文件中添加 "maatwebsite/excel": "^3.1"

     "require": {
         "php": "^7.3 || ^8.0",
         "illuminate/support": "^5.5|^6|^7|^8",
         "dompdf/dompdf": "^1",
         "maatwebsite/excel": "^3.1"
     },
    
  2. 现在请确保更新作曲家

    composer update
    

0
投票

用户@DESKTOP-6K9E3BI MINGW64 /c/tugas12 $ 作曲家需要 maatwebsite/excel ./composer.json 已更新 运行 Composer update maatwebsite/excel 加载包含包信息的 Composer 存储库 更新依赖项 锁定文件中没有任何可修改的内容 从锁定文件安装依赖项(包括 require-dev) 无需安装、更新或删除 phpoffice/phpexcel 软件包已被废弃,您应该避免使用它。请改用 phpoffice/phpspreadsheet。 生成优化的自动加载文件

© www.soinside.com 2019 - 2024. All rights reserved.