【问题标题】:Composer dependency error when installing Sylius Bundles into Symfony 2.4将 Sylius Bundles 安装到 Symfony 2.4 时的 Composer 依赖错误
【发布时间】:2014-03-01 13:11:46
【问题描述】:

我在将 Sylius Bundle(即 SyliusProductBundle)安装到新的 Symfony 2.4 安装时遇到问题

rm -rf * .gitignore .travis.yml
composer create-project symfony/framework-standard-edition ./ 2.4.* --prefer-dist

Symfony 安装顺利完成: 使用 debug true 清除开发环境的缓存 使用硬拷贝选项安装资产 将 Symfony\Bundle\FrameworkBundle 的资产安装到 web/bundles/framework 将 Acme\DemoBundle 的资产安装到 web/bundles/acmedemo 将 Sensio\Bundle\DistributionBundle 的资产安装到 web/bundles/sensiodistribution

开始吧,在安装包旁边 - 让我们首先使用docs 中描述的方式:

composer require "sylius/product-bundle":"1.0.*@dev"

失败:

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for sylius/product-bundle 1.0.*@dev -> satisfiable by sylius/product-bundle[1.0.x-dev].
    - sylius/product-bundle 1.0.x-dev requires sylius/resource-bundle 1.0.*@dev -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

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

我已经尝试了几件事(包括安装 Doctrine Bundle 1.3,它导致更多错误指一些 Class 丢失,因此无法清除缓存):

2.2751   19015200   9. require('-ABSOLUTE PATH HERE-vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/CollectionRegionDoctrineCommand.php') -ABSOLUTE PATH HERE-vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:120

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception



  [RuntimeException]
  An error occurred when executing the "'cache:clear --no-warmup'" command.

我读到这可能是我的配置有问题,这就是为什么我确保系统时区设置正确,它确实是。 我的设置如下: Mac OS X 10.9 MAMP 免费使用 PHP 5.4.10,安装的扩展包括 XDebug 和 XCache 我在这方面不走运,希望有一个解决方案。

谢谢!

按照建议,我的 composer.json

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "~2.4",
        "doctrine/orm": "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle": "~1.2",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~2.3",
        "sensio/framework-extra-bundle": "~3.0",
        "sensio/generator-bundle": "~2.3",
        "incenteev/composer-parameter-handler": "~2.0"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.4-dev"
        }
    }
}

【问题讨论】:

  • 向我们展示 composer.json
  • 嘿,composer.json 是 Symfony 的默认值——无论如何我都会将它添加到帖子中。谢谢!
  • 您尝试安装捆绑包的@dev 版本是否有任何具体原因?您真的需要在最新的~1.0 版本之后添加的任何内容吗?否则解决方案将非常简单......省略@dev。

标签: php symfony composer-php sylius


【解决方案1】:

您必须在 composer.json 中添加 "minimum-stability": "dev"

这是带有 "sylius/product-bundle":"1.0.*@dev" 的 composer.json

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "~2.4",
        "doctrine/orm": "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle": "~1.2",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~2.3",
        "sensio/framework-extra-bundle": "~3.0",
        "sensio/generator-bundle": "~2.3",
        "incenteev/composer-parameter-handler": "~2.0",
"sylius/product-bundle":"1.0.*@dev"
    },
"minimum-stability": "dev",
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.4-dev"
        }
    }
}

【讨论】:

  • 与其降低整个项目的最低稳定性,不如把所有不稳定的包都加上@dev后缀。
【解决方案2】:

如果我只是将我的学说包更新到 ~1.3,会不会有问题。

完成此操作后,我运行了作曲家更新。然后做了一个require sylius产品包。工作正常!

【讨论】:

    猜你喜欢
    • 2022-08-15
    • 2014-05-15
    • 2015-01-24
    • 2014-09-18
    • 2022-07-08
    • 2017-06-28
    • 1970-01-01
    • 1970-01-01
    • 2015-10-27
    相关资源
    最近更新 更多