作曲家无法加载软件包无效的版本字符串

时间:2020-09-08 20:30:35

标签: docker symfony composer-php

我遇到了范围问题,当我尝试在本地安装某些捆绑软件时遇到了erro,但是当我尝试在测试服务器中安装同一捆绑软件时,所有安装的内容都没有错误。我使用docker-compose并在映像中安装捆绑软件。所有依赖项的docker-copose和其他docker文件绝对相同,全部在git中。

composer require league/flysystem-bundle

在本地我遇到了

为联盟/ flysystem-bundle使用版本dev-master ./composer.json已更新 使用软件包信息加载作曲家存储库 更新依赖关系(包括require-dev) 将“ symfony / symfony”中列出的软件包限制为“ 5.0。*”

安装失败,将./composer.json恢复为其原始内容。

  [RuntimeException]                                                           
  Could not load package ezsystems/ezplatform in http://repo.packagist.org: [  
  UnexpectedValueException] Could not parse version constraint dev-load-varni  
  sh-only-when-used as ^2.0@dev: Invalid version string "^2.0@dev"             
                                                                               

                                                                               
  [UnexpectedValueException]                                                   
  Could not parse version constraint dev-load-varnish-only-when-used as ^2.0@  
  dev: Invalid version string "^2.0@dev" 

本地Composer版本Composer版本1.10.11 2020-09-08 16:53:44

和测试服务器

/var/www/symfony # composer require league/flysystem-bundle
Using version dev-master for league/flysystem-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.0.*"

Prefetching 3 packages ? ?
  - Downloading (100%)

Package operations: 3 installs, 0 updates, 0 removals
  - Installing league/mime-type-detection (1.4.0): Loading from cache
  - Installing league/flysystem (1.x-dev 53f16fd): Loading from cache
  - Installing league/flysystem-bundle (dev-master 525845a): Loading from cache
Package easycorp/easy-log-handler is abandoned, you should avoid using it. No replacement was suggested.
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
Writing lock file
Generating autoload files
20 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Symfony operations: 1 recipe (c67222ac592a52b7dec1c2cd56763685)
  -  WARNING  league/flysystem-bundle (>=1.0): From github.com/symfony/recipes-contrib:master
    The recipe for this package comes from the "contrib" repository, which is open to community contributions.
    Review the recipe at https://github.com/symfony/recipes-contrib/tree/master/league/flysystem-bundle/1.0

    Do you want to execute this recipe?
    [y] Yes
    [n] No
    [a] Yes for all packages, only for the current installation session
    [p] Yes permanently, never ask again for this project
    (defaults to n): 
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [OK]
Executing script assets:install public [OK]

测试服务器composer版本Composer版本1.10.10 2020-08-03 11:35:19

我的dockerfile

FROM alpine:edge

LABEL maintainer="Vincent Composieux <vincent.composieux@gmail.com>"

RUN apk add --update --no-cache \
    coreutils \
    yarn \
    php7-fpm \
    php7-apcu \
    php7-ctype \
    php7-curl \
    php7-dom \
    php7-gd \
    php7-iconv \
    php7-imagick \
    php7-json \
    php7-intl \
    php7-mcrypt \
    php7-fileinfo\
    php7-mbstring \
    php7-opcache \
    php7-openssl \
    php7-pdo \
    php7-pdo_mysql \
    php7-mysqli \
    php7-pdo_pgsql \
    php7-pgsql \
    php7-xml \
    php7-zlib \
    php7-phar \
    php7-tokenizer \
    php7-session \
    php7-simplexml \
    php7-xdebug \
    php7-zip \
    php7-xmlwriter \
    make \
    curl \
    zlib-dev \
    libxml2-dev \
    rabbitmq-c-dev \
    oniguruma-dev \
    php7-pecl-amqp \
    php7-amqp \
    php7-redis

RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ php7-pecl-mongodb

RUN echo "$(curl -sS https://composer.github.io/installer.sig) -" > composer-setup.php.sig \
        && curl -sS https://getcomposer.org/installer | tee composer-setup.php | sha384sum -c composer-setup.php.sig \
        && php composer-setup.php && rm composer-setup.php* \
        && chmod +x composer.phar && mv composer.phar /usr/bin/composer

COPY symfony.ini /etc/php7/conf.d/
COPY symfony.ini /etc/php7/cli/conf.d/
COPY xdebug.ini  /etc/php7/conf.d/

COPY symfony.pool.conf /etc/php7/php-fpm.d/

CMD ["php-fpm7", "-F"]

WORKDIR /var/www/symfony
EXPOSE 9001

为什么我同时面对不同版本的作曲家。以相同的方式,通过相同的Dockerfile安装Composer。如何解决这个问题? 我不相信,怎么可能,使用docker结构时不应该出现此问题。

3 个答案:

答案 0 :(得分:5)

看起来像作曲家1.10.11已损坏。您可以像这样切换到1.10.10:

composer-setup.php --version=1.10.10

答案 1 :(得分:1)

确认来自作曲者1.10.11的错误。您应该使用作曲家v1.10.10。

composer self-update 1.10.10

您可以使用自我更新来降级作曲家的版本

答案 2 :(得分:0)

现在您可以将作曲家的版本更新为1.10.12

在此版本中,您没有此错误。