简体   繁体   English

作曲家错误:UnexpectedValueException

[英]Composer error: UnexpectedValueException

My composer suddenly stopped working. 我的作曲家突然停止工作了。 I didn't even add new packages, just wanted to check, if there are any updates: 我什至没有添加新软件包,只是想检查一下是否有任何更新:

PS C:\data\www\project.dev> composer self-update
You are already using composer version 1.3.2 (stable channel).

PS C:\data\www\project.dev> composer update
> php artisan clear-compiled
The compiled class file has been removed.
Loading composer repositories with package information
Updating dependencies (including require-dev)

  [UnexpectedValueException]
  Could not parse version constraint >=~2: Invalid version string "~2"


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock]...

All solutions I found so far suggested to update composer and check the composer.json , but there shouldn't nu anything wrong in there: 到目前为止,我发现的所有解决方案都建议更新composer并检查composer.json ,但其中不应有任何错误:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.3.*",
        "edofre/laravel-fullcalendar-scheduler": "^1.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "5.0",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

As you can see, there is nothing special in there. 如您所见,其中没有什么特别的。

PS: Of course, I already chkecked this and this , but those are unrelated problems. PS:当然,我已经chkecked 这个这个 ,但这些都是无关的问题。

EDIT: 编辑:

The Problem is fixed in the 1.3.0@dev version of the composer-asset-plugin. 该问题已在composer-asset-plugin的1.3.0@dev版本中修复。

It can be installed via: 可以通过以下方式安装:

composer global require fxp/composer-asset-plugin:~1.3@dev

See also: https://github.com/fxpio/composer-asset-plugin/issues/270 另请参阅: https : //github.com/fxpio/composer-asset-plugin/issues/270


I have tracked down your problem using the verbose output of composer. 我已经使用composer的详细输出跟踪了您的问题。

The problem is initially caused by requiring 该问题最初是由于要求

"edofre/laravel-fullcalendar-scheduler": "^1.0"

Within this some bower packages are required ( For this I assume you installed Composer Asset Plugin -at least I had to do this as stated in the docs of laravel-fullcalendar-scheduler) 在其中需要一些Bower软件包(为此,我假设您安装了Composer Asset Plugin-至少我必须按照laravel-fullcalendar-scheduler的文档中所述执行此操作)

One of these bower packages is for example: 这些凉亭包之一例如:

 "bower-asset/fullcalendar-scheduler": "v1.4.0"

The Bower fullcalender-schedulare has some dependencies ( in bower.json): Bower fullcalender-schedulare具有一些依赖性(在bower.json中):

 "dependencies": {
    "jquery": "2 - 3",
    "moment": "^2.9.0",
    "fullcalendar": "~3.2.0"
},

The used composer asset plugin translates the jquery dependency to: 使用的作曲家资产插件将jquery依赖项转换为:

">=~2,<4.0"

This finally causes the error in the composer module https://github.com/composer/semver which raises an error composer/semver/src/VersionParser.php:485 这最终在composer模块https://github.com/composer/semver中导致错误,从而引发错误composer / semver / src / VersionParser.php:485

For testing i have manually changed the version to >=2.0 which is working. 为了进行测试,我已经手动将版本更改为> = 2.0了。

I currently have not investigated wheter this is a bug in the composer/semver lib or a bug in the composer asset plugin. 我目前还没有调查这是作曲家/ semver库中的错误还是作曲家资产插件中的错误。

The composer docs say that ~2 is a valid version number, but I don't know if it is supposed to be used in comparisons like ">~2" ( in my oppionion this makes no sense at all... ) 作曲家的文档说〜2是有效的版本号,但我不知道是否应该在“>〜2”之类的比较中使用它(在我看来,这根本没有意义...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 更新时出现Composer错误[UnexpectedValueException] - Composer error on update [UnexpectedValueException] 作曲家错误[UnexpectedValueException] - Composer error [UnexpectedValueException] Mac上的Laravel 5.5“ UnexpectedValueException”,安装错误 - Laravel 5.5 “UnexpectedValueException” on Mac, installation error 作曲者-[UnexpectedValueException]无法解析版本约束README.md:无效的版本字符串“ README.md” - composer - [UnexpectedValueException] Could not parse version constraint README.md: Invalid version string “README.md” Laravel:在 mac 中在本地主机上托管 xampp 时出现错误 UnexpectedValueException - Laravel: while hosting xampp on localhost in mac getting an error UnexpectedValueException 作曲家安装和作曲家更新时作曲家错误? - composer error while composer install and composer update? 致命错误:未捕获UnexpectedValueException:服务器返回了意外的值。 预期为“ HTTP / 1.1 101”,带有“” - Fatal error: Uncaught UnexpectedValueException: The server returned an unexpected value. Expected “HTTP/1.1 101”, had “” InvalidArgumentException与UnexpectedValueException - InvalidArgumentException vs UnexpectedValueException 响应时Laravel 5 UnexpectedValueException - Laravel 5 UnexpectedValueException on response Laravel 返回 UnexpectedValueException - Laravel returning UnexpectedValueException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM