Composer无法加载程序包无效的版本字符串 [英] composer could not load package Invalid version string

查看:6
本文介绍了Composer无法加载程序包无效的版本字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了范围问题,当我尝试在本地安装一些包时,遇到了错误,但当我尝试在测试服务器中安装相同的包时,所有安装都没有错误。我在图像中使用了docker-compose和安装捆绑包。Docker-Copose和其他所有依赖项完全相同的Docker文件,均为GIT格式。

composer require league/flysystem-bundle

而在当地我面对的是

将版本dev-master用于联盟/flysystem-捆绑包 ./Composer.json已更新 使用包信息加载Composer存储库 更新依赖项(包括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 Version 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 Version 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

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

推荐答案

看起来Composer 1.10.11已损坏。您可以这样切换到1.10.10:

composer-setup.php --version=1.10.10

这篇关于Composer无法加载程序包无效的版本字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆