Composer php Symfony 4 composer:无法安装捆绑包

Composer php Symfony 4 composer:无法安装捆绑包,composer-php,Composer Php,我最近创建了一个symfony bundle源代码如下: 当我试图在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

我最近创建了一个symfony bundle源代码如下:

当我试图在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(但对于使用SF4.3从头开始的新项目仍然是一样的):


有人能帮我吗?

作曲家对“替换”部分有问题。
\uuuu root\uuuu
名称指的是您的项目(当未指定“name”键时,它是默认名称)

基本上,您将两个包(主项目和RESTAPI包)都标记为symfony/polyfill-*的替代品。我不清楚为什么——可能是弄错了

您应该从两个包中删除“replace”部分,然后就可以开始了

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

能否运行
composer为什么不运行nbo/restapi bundle
?这里讨论了一个类似的问题:非常感谢您为我省去了很多麻烦!好的,顺便说一句,我没有添加我自己这个“替换”部分,它是从默认的symfony 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/"
    }
  },
  "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.*"
    }
  }
}