Symfony 4作曲家:无法安装捆绑软件

时间:2019-10-23 12:27:07

标签: composer-php

我最近创建了一个symfony捆绑包,来源在这里:

https://gitlab.com/nicolasbonnici/restapibundle

当我尝试通过Symfony 4.3项目(从头创建或已经存在)上的composer要求它时,出现此错误:

composer req nbo/rest-api-bundle
Using version ^1.1 for nbo/rest-api-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.3.*"
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - don't install nbo/rest-api-bundle 1.1.0|remove __root__ dev-master
    - don't install nbo/rest-api-bundle 1.1.1|remove __root__ dev-master
    - don't install nbo/rest-api-bundle 1.1.2|remove __root__ dev-master
    - Installation request for __root__ dev-master -> satisfiable by __root__[dev-master].
    - Installation request for nbo/rest-api-bundle ^1.1 -> satisfiable by nbo/rest-api-bundle[1.1.0, 1.1.1, 1.1.2].

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

这是项目的composer.json(但对于使用SF 4.3从头开始的新项目来说仍然如此):

    {
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "aws/aws-sdk-php": "^3.112",
        "easycorp/easyadmin-bundle": "^2.3",
        "friendsofsymfony/rest-bundle": "^2.5",
        "intervention/image": "^2.5",
        "lexik/jwt-authentication-bundle": "^2.6",
        "nelmio/api-doc-bundle": "^3.4",
        "nelmio/cors-bundle": "^1.5",
        "sensio/framework-extra-bundle": "^5.4",
        "stof/doctrine-extensions-bundle": "^1.3",
        "symfony/cache": "4.3.*",
        "symfony/console": "4.3.*",
        "symfony/dotenv": "4.3.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "4.3.*",
        "symfony/framework-bundle": "4.3.*",
        "symfony/orm-pack": "^1.0",
        "symfony/security-csrf": "4.3.*",
        "symfony/serializer-pack": "^1.0",
        "symfony/swiftmailer-bundle": "^3.2",
        "symfony/templating": "4.3.*",
        "symfony/twig-bundle": "4.3.*",
        "symfony/validator": "4.3.*",
        "symfony/yaml": "4.3.*"
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.2",
        "fzaninotto/faker": "^1.8",
        "symfony/maker-bundle": "^1.12",
        "symfony/phpunit-bridge": "^4.3",
        "symfony/profiler-pack": "^1.0",
        "symfony/web-server-bundle": "4.3.*"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.3.*"
        }
    }
}

有人可以帮我吗?

1 个答案:

答案 0 :(得分:1)

Composer的“替换”部分有问题。 __root__名称是指您的项目(未指定“名称”键时,它是默认名称)。

基本上,您将两个软件包(您的主项目和rest-api-bundle)都标记为symfony / polyfill- *的替代品。我不清楚原因为何-可能是错误的。

您应该从两个软件包中删除“替换”部分,然后就可以了。

{
  "type": "project",
  "license": "proprietary",
  "require": {
    "php": "^7.1.3",
    "ext-ctype": "*",
    "ext-iconv": "*",
    "aws/aws-sdk-php": "^3.112",
    "easycorp/easyadmin-bundle": "^2.3",
    "friendsofsymfony/rest-bundle": "^2.5",
    "intervention/image": "^2.5",
    "lexik/jwt-authentication-bundle": "^2.6",
    "nelmio/api-doc-bundle": "^3.4",
    "nelmio/cors-bundle": "^1.5",
    "sensio/framework-extra-bundle": "^5.4",
    "stof/doctrine-extensions-bundle": "^1.3",
    "symfony/cache": "4.3.*",
    "symfony/console": "4.3.*",
    "symfony/dotenv": "4.3.*",
    "symfony/flex": "^1.3.1",
    "symfony/form": "4.3.*",
    "symfony/framework-bundle": "4.3.*",
    "symfony/orm-pack": "^1.0",
    "symfony/security-csrf": "4.3.*",
    "symfony/serializer-pack": "^1.0",
    "symfony/swiftmailer-bundle": "^3.2",
    "symfony/templating": "4.3.*",
    "symfony/twig-bundle": "4.3.*",
    "symfony/validator": "4.3.*",
    "symfony/yaml": "4.3.*"
  },
  "require-dev": {
    "doctrine/doctrine-fixtures-bundle": "^3.2",
    "fzaninotto/faker": "^1.8",
    "symfony/maker-bundle": "^1.12",
    "symfony/phpunit-bridge": "^4.3",
    "symfony/profiler-pack": "^1.0",
    "symfony/web-server-bundle": "4.3.*"
  },
  "config": {
    "preferred-install": {
      "*": "dist"
    },
    "sort-packages": true
  },
  "autoload": {
    "psr-4": {
      "App\\": "src/"
    }
  },
  "autoload-dev": {
    "psr-4": {
      "App\\Tests\\": "tests/"
    }
  },
  "scripts": {
    "auto-scripts": {
      "cache:clear": "symfony-cmd",
      "assets:install %PUBLIC_DIR%": "symfony-cmd"
    },
    "post-install-cmd": [
      "@auto-scripts"
    ],
    "post-update-cmd": [
      "@auto-scripts"
    ]
  },
  "conflict": {
    "symfony/symfony": "*"
  },
  "extra": {
    "symfony": {
      "allow-contrib": false,
      "require": "4.3.*"
    }
  }
}