Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.0k views
in Technique[技术] by (71.8m points)

docker - composer could not load package Invalid version string

I faced with range case, when I was try to install some bundle in locally I faced with erro, but when I try install the same bundle in test server everything installed without error. I use docker-compose and install bundle inside in image. docker-copose and other docker file with all dependecies absolutelty the same, all in git.

composer require league/flysystem-bundle

and in locally I faced with that

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.*"

Installation failed, reverting ./composer.json to its original content.

  [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" 

locally composer version Composer version 1.10.11 2020-09-08 16:53:44

and test server

/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]

test server composer version Composer version 1.10.10 2020-08-03 11:35:19

my 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

Why in the same time I faced with differnt version composer. Composer installed by the same way, by the same Dockerfile. How to fix this problem ? I don't belive, how it's possible, this problem don't should be appear when using docker structure.. ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Looks like composer 1.10.11 is broken. You can switch to 1.10.10 like this:

composer-setup.php --version=1.10.10

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...