composer安装会在Gitlab CI上产生错误

时间:2018-11-02 19:30:17

标签: php composer-php gitlab-ci

我尝试在Gitlab运行程序上运行 composer install 命令。我想首先在运行程序上安装依赖项。但是我得到以下错误。当我在本地计算机上尝试时,我安装了所有依赖项而没有错误。

Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - don't install symfony/security-guard 4.1.x-dev|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard 4.2.x-dev|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard v4.1.0|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard v4.1.0-BETA1|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard v4.1.0-BETA2|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard v4.1.0-BETA3|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard v4.1.1|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard v4.1.2|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard v4.1.3|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard v4.1.4|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard v4.1.5|don't install symfony/symfony v3.4.17
    - don't install symfony/security-guard v4.1.6|don't install symfony/symfony v3.4.17
    - Installation request for symfony/symfony 3.4.17 -> satisfiable by symfony/symfony[v3.4.17].
    - Installation request for symfony/security-guard ^4.1 -> satisfiable by symfony/security-guard[4.1.x-dev, 4.2.x-dev, v4.1.0, v4.1.0-BETA1, v4.1.0-BETA2, v4.1.0-BETA3, v4.1.1, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6].

我的Gitlab CI文件;

image: php:7.1

variables:
  ENV: master
  LABEL: latest
  DOCKER_DRIVER: overlay
stages:
- master

services:
- docker:dind

before_script:
- apt-get update
- apt-get install -y zip unzip wget apt-transport-https curl software-properties-common gnupg2 libmcrypt-dev
- apt-get install -y make ca-certificates openssl python
- apt-get install -y libxml2-dev --no-install-recommends
- docker-php-ext-install bcmath xml mbstring
- docker-php-ext-install mysqli pdo pdo_mysql
- export COMPOSER_MEMORY_LIMIT=-1
- export COMPOSER_ALLOW_SUPERUSER=1
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php
- php -r "unlink('composer-setup.php');"
- mv composer.phar /usr/local/bin/composer

build:
  stage: master
  script:
  - composer install
  - cd res/deployment/
  - sh build.sh
  only:
  - master

2 个答案:

答案 0 :(得分:0)

它与作曲者的版本有关,我无法完全解决问题,但我将作曲者的版本恢复为1.7.2,并且可以使用!

答案 1 :(得分:0)

似乎作曲家无法解决您所说的相矛盾的依赖关系。 symfony / symfony:3.4。*取决于symfony / security-guard:3.4。*(请参阅https://github.com/symfony/symfony/blob/3.4/composer.json),但是您明确需要版本4.1.x。

尝试composer remove symfony/security-guard && composer require symfony/security-guard:3.4.*