[PROMOÇÃO] Assine com + 30% de desconto ANUAL MENSAL (últimas horas)
Albert Reis da Cruz
Criador Albert Reis da Cruz 31/03/2022

Carlos, Bom dia Amigo.

Estou diante de um erro ao instalar o pacote laravel-excel, ao rodar o composer require maatwebsite/excel, recebo um erro :

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.22.0].

    - maatwebsite/excel 3.1.27 requires phpoffice/phpspreadsheet ^1.16 -> satisfiable by phpoffice/phpspreadsheet[1.16.0, ..., 1.22.0].

    - maatwebsite/excel 3.1.26 requires phpoffice/phpspreadsheet ^1.15 -> satisfiable by phpoffice/phpspreadsheet[1.15.0, ..., 1.22.0].

    - maatwebsite/excel[3.1.22, ..., 3.1.25] require phpoffice/phpspreadsheet ^1.14 -> satisfiable by phpoffice/phpspreadsheet[1.14.0, ..., 1.22.0].

    - maatwebsite/excel 3.1.0 requires illuminate/support ^5.5 -> found illuminate/support[v5.5.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.

    - maatwebsite/excel[3.1.1, ..., 3.1.6] require illuminate/support 5.5.* || 5.6.* || 5.7.* -> found illuminate/support[v5.5.0, ..., 5.7.x-dev] but these were not loaded, likely because it conflicts with another require.

    - maatwebsite/excel[3.1.7, ..., 3.1.15] require illuminate/support 5.5.*|5.6.*|5.7.*|5.8.* -> found illuminate/support[v5.5.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.

    - maatwebsite/excel[3.1.16, ..., 3.1.18] require illuminate/support 5.5.*|5.6.*|5.7.*|5.8.*|^6.0 -> found illuminate/support[v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev] but these were not loaded, likely because it conflicts with another require.

    - maatwebsite/excel[3.1.19, ..., 3.1.21] require illuminate/support 5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0 -> found illuminate/support[v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev] but these were not loaded, likely because it conflicts with another require.

    - phpoffice/phpspreadsheet[1.14.0, ..., 1.22.0] require ext-zip * -> it is missing from your system. Install or enable PHP's zip 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:

    - 

    - /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini

    - /usr/local/etc/php/conf.d/docker-php-ext-exif.ini

    - /usr/local/etc/php/conf.d/docker-php-ext-gd.ini

    - /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini

    - /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini

    - /usr/local/etc/php/conf.d/docker-php-ext-redis.ini

    - /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini

    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.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-zip` 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.

não consegui instalar a extensão solicitada.

estou usando o Dockerfile, mesmo que vc utiliza nas aulas:

FROM php:7.4-fpm

# Arguments defined in docker-compose.yml
ARG user
ARG uid

# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd sockets

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user

# Install redis
RUN pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis

# Set working directory
WORKDIR /var/www

USER $user

 

 

Manager Carlos Ferreira 31/03/2022

Olá, Albert!
Tudo bem?

O erro é porque o seu setup não tem habilitado a extensão ext-zip

Você consegue prosseguir com a instalação com o seguinte comando:
composer require maatwebsite/excel --ignore-platform-req=ext-zip

---

No seu Dockerfile faltou:
docker-php-ext-configure zip --with-libzip

Após incluir isso, recrie a imagem:
docker-compose up -d --build

Carlos Ferreira
Criador Albert Reis da Cruz 31/03/2022

esqueci de avisar, já tentei colocar docker-php-ext-configure zip --with-libzip, não funcionou, deu este erro:

configure: error: unrecognized options: --with-libzip

ERROR: Service 'newttech' failed to build: The command '/bin/sh -c docker-php-ext-configure zip --with-libzip' returned a non-zero code: 1

quanto a instalar deste jeito: "composer require maatwebsite/excel --ignore-platform-req=ext-zip", tb já fiz, instalou mas não executou as funções, ficou inútil

Obrigado

 

Albert Reis da Cruz
Manager Carlos Ferreira 31/03/2022

Certo, tem o código com o Dockerfile no GitHub?
Vou rodar aqui e testar para você;

No aguardo.

Carlos Ferreira
Criador Albert Reis da Cruz 31/03/2022

bom dia, tenho o git sim.

É o mesmo da outra dúvida sobre observer.

https://github.com/zurctrebla/new-ttech

 

Albert Reis da Cruz
Manager Carlos Ferreira 31/03/2022

Fiz o teste aqui, inclui isso no Dockerfile:
https://github.com/laradock/laradock/blob/master/php-fpm/Dockerfile#L57

Fiz o build novamente (--build), e deu certo.

Segue o Dockerfile:
FROM php:7.4-fpm

# Arguments defined in docker-compose.yml
ARG user=carlos
ARG uid=1001

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    curl \
    libpng-dev \
    libonig-dev \
    libxml2-dev \
    libzip-dev zip unzip

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd sockets zip

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
    chown -R $user:$user /home/$user

# Install redis
RUN pecl install -o -f redis \
    &&  rm -rf /tmp/pear \
    &&  docker-php-ext-enable redis

# Set working directory
WORKDIR /var/www

USER $user

Carlos Ferreira
Criador Albert Reis da Cruz 31/03/2022

Resolvido!!

Obrigado Carlos!

Albert Reis da Cruz
Sabe a Solução? Ajude a resolver!

Precisa estar logado para conseguir responder a este ticket!

Clique Aqui Para Entrar!