更新时的Composer错误[UnexpectedValueException]

时间:2018-04-06 13:14:40

标签: php yii2 composer-php

尝试更新作曲家时出现此错误。

我正在使用这个命令:

composer update -v --no-dev

我在下面得到了这个错误(堆栈跟踪):

Adding VCS repository npm-asset/lodash.uniq 
Adding VCS repository npm-asset/lodash.without
Adding VCS repository npm-asset/mississippi   
Adding VCS repository npm-asset/mkdirp     


[UnexpectedValueException]                                          
Could not parse version constraint &&: Invalid version string "&&"  


Exception trace:
 () at phar:///usr/local/bin/composer/vendor/composer/semver/src/VersionParser.php:485
 Composer\Semver\VersionParser->parseConstraint() at phar:///usr/local/bin/composer/vendor/composer/semver/src/VersionParser.php:244
 Composer\Semver\VersionParser->parseConstraints() at phar:///usr/local/bin/composer/src/Composer/Package/Version/VersionParser.php:28
 Composer\Package\Version\VersionParser->parseConstraints() at phar:///usr/local/bin/composer/src/Composer/Package/Loader/ArrayLoader.php:238
 Composer\Package\Loader\ArrayLoader->parseLinks() at phar:///usr/local/bin/composer/src/Composer/Package/Loader/ArrayLoader.php:122
 Composer\Package\Loader\ArrayLoader->load() at /root/.composer/vendor/fxp/composer-asset-plugin/Repository/NpmRepository.php:133
 Fxp\Composer\AssetPlugin\Repository\NpmRepository->createArrayRepositoryConfig() at /root/.composer/vendor/fxp/composer-asset-plugin/Repository/NpmRepository.php:79
 Fxp\Composer\AssetPlugin\Repository\NpmRepository->createVcsRepositoryConfig() at /root/.composer/vendor/fxp/composer-asset-plugin/Repository/AbstractAssetsRepository.php:136
 Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository->whatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:204
 Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:193
 Composer\DependencyResolver\Pool->whatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:161
 Composer\DependencyResolver\RuleSetGenerator->whitelistFromPackage() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:273
 Composer\DependencyResolver\RuleSetGenerator->whitelistFromJobs() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:324
 Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php:214
 Composer\DependencyResolver\Solver->solve() at phar:///usr/local/bin/composer/src/Composer/Installer.php:473
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:227
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:161
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:242
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:842
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:193
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:251
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:100
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:58
 require() at /usr/local/bin/composer:24

任何人都可以帮我找到解决这个问题的方法吗?

更新

composer.json文件:


{
    "name" : "yiisoft/yii2-app-basic",
    "description" : "Yii 2 Basic Project Template",
    "keywords" : [
        "yii2",
        "framework",
        "basic",
        "project template"
    ],
    "homepage" : "http://www.yiiframework.com/",
    "type" : "project",
    "license" : "BSD-3-Clause",
    "support" : {
        "issues" : "https://github.com/yiisoft/yii2/issues?state=open",
        "forum" : "http://www.yiiframework.com/forum/",
        "wiki" : "http://www.yiiframework.com/wiki/",
        "irc" : "irc://irc.freenode.net/yii",
        "source" : "https://github.com/yiisoft/yii2"
    },
    "minimum-stability" : "dev",
    "require" : {
        "php" : ">=5.4.0",
        "yiisoft/yii2" : ">=2.0.11",
        "yiisoft/yii2-bootstrap" : "@dev",
        "yiisoft/yii2-swiftmailer" : "@dev",
        "kartik-v/yii2-widget-select2" : "@dev",
        "kartik-v/yii2-grid" : "@dev",
        "kartik-v/yii2-krajee-base" : "@dev",
        "kartik-v/yii2-mpdf" : "v1.0.0",
        "kartik-v/yii2-editable" : "@dev",
        "kartik-v/yii2-tabs-x" : "@dev",
        "kartik-v/yii2-widget-fileinput" : "@dev",
        "kartik-v/yii2-money" : "*",
        "kartik-v/yii2-widget-datepicker" : "@dev",
        "kartik-v/yii2-widget-activeform" : "@dev",
        "kartik-v/yii2-widget-depdrop" : "@dev",
        "kartik-v/yii2-widgets" : "*",
        "kartik-v/yii2-widget-typeahead" : "*",
        "yiibr/yii2-br-validator" : "*",
        "kartik-v/yii2-builder" : "@dev",
        "softark/yii2-dual-listbox" : "dev-master",
        "kartik-v/yii2-widget-sidenav" : "*",
        "kartik-v/yii2-popover-x" : "@dev",
        "kartik-v/yii2-export" : "*",
        "kartik-v/yii2-detail-view" : "*",
        "bower-asset/Chart.js" : "*",
        "codeception/specify" : "*",
        "codeception/verify" : "*",
        "kartik-v/yii2-date-range" : "^1.6",
        "kartik-v/yii2-checkbox-x" : "*",
        "zendframework/zend-servicemanager" : "^2.7.5 || ^3.0.3",
        "bower-asset/toastr" : "^2.1",
        "cossou/jasperphp" : "2.3.0",
        "endroid/qr-code" : "~2.4.0",
        "nfephp-org/posprint" : "^0.1",
        "nfephp-org/sped-nfe" : "^4.1@dev",
        "nfephp-org/sped-da" : "*"
    },
    "require-dev" : {
        "codeception/codeception" : "2.1.*",
        "yiisoft/yii2-debug" : "*",
        "yiisoft/yii2-gii" : "*",
        "yiisoft/yii2-faker" : "*"
    },
    "config" : {
        "process-timeout" : 1800
    },
    "scripts" : {
        "post-create-project-cmd" : "yii\\composer\\Installer::postCreateProject"
    },
    "extra" : {
        "yii\\composer\\Installer::postCreateProject" : {
            "setPermission" : [{
                    "runtime" : "0777",
                    "web/assets" : "0777",
                    "yii" : "0755"
                }
            ],
            "generateCookieValidationKey" : [
                "config/web.php"
            ]
        },
        "asset-installer-paths" : {
            "npm-asset-library" : "vendor/npm",
            "bower-asset-library" : "vendor/bower"
        }
    }
}

作曲家已经更新到最后版本,似乎没有“&&”约束错误。当我在本地计算机上运行composer update时,它运行正常,但是当我在服务器上执行相同操作时,它会返回此错误。

1 个答案:

答案 0 :(得分:0)

正如评论中所说,解决的问题是在本地和服务器上检查fxp / composer-asset-plugin的版本。更新两个解决了我的问题。

检查版本:

composer global show fxp/composer-asset-plugin

更新版本:

composer global require "fxp/composer-asset-plugin:~1.3"

检查PHP版本总是很好。