Composer 更新 - 无法在 http://packagist.org 中加载软件包 shopware/shopware:

Posted

技术标签:

【中文标题】Composer 更新 - 无法在 http://packagist.org 中加载软件包 shopware/shopware:【英文标题】:Composer Update - Could not load package shopware/shopware in http://packagist.org: 【发布时间】:2016-07-18 01:33:53 【问题描述】:

当我在我的 Laravel 5.1 上进行作曲家更新时,会出现此错误

> Downloading http://packagist.org/p/symfony/polyfill-mbstring$a9a5f6e4a8af44008f50a8c0059a6d1a61b1f692627fb41f0cc1f3e8bbfb7205.json
> Writing /root/.composer/cache/repo/https---packagist.org/provider-symfony$polyfill-mbstring.json into cache



  [RuntimeException]
  Could not load package shopware/shopware in http://packagist.org: [UnexpectedValueException] Could not parse version constraint ~v
  2.0.0-rc1: Invalid version string "~v2.0.0-rc1"




[UnexpectedValueException]
  Could not parse version constraint ~v2.0.0-rc1: Invalid version string "~v2.0.0-rc1"

当我在缓存文件夹中跟踪它时

"require-dev": 
                    "phpunit\/phpunit": "~4.5",
                    "phpunit\/dbunit": "~1.3",
                    "behat\/mink": "~1.7",
                    "behat\/mink-extension": "~2.1",
                    "behat\/mink-goutte-driver": "~1.2",
                    "behat\/mink-selenium2-driver": "~1.3",
                    "symfony\/dom-crawler": "~2.8",
                    "behat\/behat": "~3.1",
                    "sensiolabs\/behat-page-object-extension": "~v2.0.0-rc1"
                ,

它不在我的要求包中:composer.json 它来自 symfony/polyfill-mbstring 但是为什么在 json 文件中他们得到了这个?

"packages": 
    "shopware\/shopware": 
        "5.2.x-dev": 
            "name": "shopware\/shopware",
            "description": "Shopware is the next generation of open source e-commerce software made in Germany",
            "keywords": ["shop", "shopware"],
            "homepage": "http:\/\/www.shopware.com",
            "version": "5.2.x-dev",
            "version_normalized": "5.2.9999999.9999999-dev",
            "license": ["AGPL-3.0", "proprietary"],
            "authors": [],
            "source": 
                "type": "git",
                "url": "https:\/\/github.com\/shopware\/shopware.git",
                "reference": "4c4817979a98144e57d9eebc5aa166795e378a1c"
            ,
            "dist": 
                "type": "zip",
                "url": "https:\/\/api.github.com\/repos\/shopware\/shopware\/zipball\/4c4817979a98144e57d9eebc5aa166795e378a1c",
                "reference": "4c4817979a98144e57d9eebc5aa166795e378a1c",
                "shasum": ""
            ,
            "type": "project",
            "time": "2016-03-29T06:54:10+00:00",
            "autoload": 
                "psr-0": 
                    "Doctrine\\Common\\Proxy\\AbstractProxyFactory": "engine\/Library\/",
                    "Doctrine\\ORM\\Persisters\\Entity\\BasicEntityPersister": "engine\/Library\/",
                    "Shopware": "engine\/",
                    "Enlight": "engine\/Library\/",
                    "Zend": "engine\/Library\/",
                    "JSMin": "engine\/Library\/minify\/"
                ,
                "classmap": ["engine\/Shopware\/Core\/"],
                "files": ["engine\/Shopware\/Application.php"]
            ,
            "include-path": ["engine\/Library\/"],
            "require": 
                "php": ">=5.5.9",
                "ext-curl": "*",
                "ext-mbstring": "*",
                "ext-gd": "*",
                "doctrine\/common": "2.5.1",
                "doctrine\/dbal": "2.5.1",
                "doctrine\/orm": "2.5.1",
                "beberlei\/assert": "2.4.0",
                "zendframework\/zend-escaper": "2.5.1",
                "oyejorge\/less.php": "1.7.0.5",
                "guzzlehttp\/guzzle": "5.1.0",
                "egulias\/email-validator": "1.2.9",
                "symfony\/http-kernel": "2.8.0",
                "symfony\/config": "2.8.0",
                "symfony\/dependency-injection": "2.8.0",
                "symfony\/validator": "2.8.0",
                "symfony\/filesystem": "2.8.0",
                "symfony\/finder": "2.8.0",
                "symfony\/console": "2.8.0",
                "symfony\/polyfill-php56": "1.0.0",
                "monolog\/monolog": "1.17.2",
                "doctrine\/cache": "1.6.0",
                "paragonie\/random_compat": "1.1.5",
                "symfony\/form": "2.8.0",
                "league\/flysystem": "1.0.18",
                "elasticsearch\/elasticsearch": "2.1.5",
                "ongr\/elasticsearch-dsl": "v2.0.0"
            ,
            "require-dev": 
                "phpunit\/phpunit": "~4.5",
                "phpunit\/dbunit": "~1.3",
                "behat\/mink": "~1.7",
                "behat\/mink-extension": "~2.1",
                "behat\/mink-goutte-driver": "~1.2",
                "behat\/mink-selenium2-driver": "~1.3",
                "symfony\/dom-crawler": "~2.8",
                "behat\/behat": "~3.1",
                "sensiolabs\/behat-page-object-extension": "~v2.0.0-rc1"
            ,
            "replace": 
                "symfony\/polyfill-php55": "~1.0",
                "symfony\/polyfill-mbstring": "~1.0"
            ,
            "uid": 588566
        , bla ...............

【问题讨论】:

【参考方案1】:

似乎是作曲家本身的问题,我们的全局作曲家也有同样的问题。 您需要清除 /root/.composer/ 中的缓存和供应商映射并更新 composer 本身:

cd /root
curl -sS https://getcomposer.org/installer | sudo php --
php composer.phar global update
rm composer.phar

【讨论】:

感谢您的回复。但我已经清除缓存并更新作曲家..实际上我使用centos 6.7时仍然出现错误【参考方案2】:

我遇到了完全相同的错误

./composer.phar selfupdate为我解决问题。

【讨论】:

我可以确认将我的 Satis 更新到最新版本可以解决我的问题 - 似乎是 Composer 中的更新版本约束检查。 @VaL 你能告诉我你的作曲家是什么版本的吗?现在 @EnDiwang Composer version 1.0-dev (e8b1a5f35772e39ca21ab855a278bd84a0a534b2) 2016-03-29 07:53:57【参考方案3】:

不是 Composer 中的问题,而是 Shopware 上游软件包的问题。

以下提交在 3 月 29 日打破了这种依赖关系: https://github.com/shopware/shopware/commit/e44e4a7d788675489aadbd664c50a7cfc47e0f05

以下提交在一天后修复了它: https://github.com/shopware/shopware/commit/0cec1d69e972150b3d1fa71b82e621031ff341e3

因此,如果您仍然遇到此问题,请使用以下命令进行修复:

composer clear-cache
composer update shopware/shopware

【讨论】:

以上是关于Composer 更新 - 无法在 http://packagist.org 中加载软件包 shopware/shopware:的主要内容,如果未能解决你的问题,请参考以下文章

Composer 更新 - 您的要求无法解析为一组可安装的软件包

PHP Composer更新“无法分配内存”错误(使用Laravel 4)

您的要求无法解析为一组可安装的软件包(Composer 更新)

Composer 无法更新或安装 PHPUnit/php-code-coverage

Composer 更新显示 mmap() 失败:[12] 无法分配内存 [重复]

Windows 更新 1903 后 Composer 无法使用 laravel