yii2作曲者更新中的“ UnexpectedValueException”

时间:2019-05-10 06:49:55

标签: yii2 composer-php gitlab composer.json

得到“ UnexpectedValueException”。yii2项目的作曲者更新时,github.com的github oauth令牌包含无效字符:“”。

当我通过作曲家安装jui datetimepicker时,我要求提供git令牌来安装它。我已经从GitLab生成了令牌并将令牌提供给终端。我还使用令牌更改了composer.json文件。但这给我一个错误“ UnexpectedValueException”。github.com的github oauth令牌包含无效字符。

我尝试了以下解决方案: 1)我已经删除了.git文件夹,并尝试更新composer仍然是同一问题

2)我已删除供应商并重新安装作曲家。

3)我已经删除了vendor和composer.json,并从备份中放入了先前的vendor和composer.json文件。但仍然遇到同样的问题。

4)我试图通过以下代码更改令牌:

composer config --global github-oauth.github.com <TOKEN>

5)还将以下代码放入composer.json中:

{  
  "config": {
    "github-oauth": {
      "github.com": "<TOKEN>"
      }
    }
} 

还是同样的问题。

我的composer.json文件如下:

{
    "name": "yiisoft/yii2-app-advanced",
    "description": "Yii 2 Advanced Application Template",
    "keywords": ["yii2", "framework", "advanced", "application 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": "stable",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": "*",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*",
        "claudejanz/yii2-mygii": "dev-master",
        "bower-asset/jquery": "@stable",
        "bower-asset/jquery.inputmask": "@stable",
        "bower-asset/punycode": "@stable",
        "bower-asset/bootstrap": "@stable",
        "3ch3r46/bootui-datepicker": "1.0.0",
        "yiisoft/yii2-jui": "*",
        "udokmeci/yii2-phone-validator" : "dev-master"
    },
    "require-dev": {
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*"
    },
    "suggest": {
        "codeception/codeception": "Codeception, 2.0.* is currently works well with Yii.",
        "codeception/specify": "BDD style code blocks for PHPUnit and Codeception",
        "codeception/verify": "BDD Assertions for PHPUnit and Codeception",
        "yiisoft/yii2-faker": "Fixtures generator for Yii2 based on Faker lib"
    },
    "scripts": {
        "post-create-project-cmd": [
            "yii\\composer\\Installer::setPermission"
        ]
    },
    "config": {
        "process-timeout": 1800
    },
    "extra": {
        "writable": [
            "backend/runtime",
            "backend/web/assets",
            "frontend/runtime",
            "frontend/web/assets"
        ],
        "executable": [
            "yii"
        ],
        "asset-installer-paths":    {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    },
    "repositories": [
    {
        "type": "composer",
        "url": "https://asset-packagist.org"
    }
]
}

请有人帮忙。

1 个答案:

答案 0 :(得分:0)

我不确定它停止为您服务的原因是什么,但是正如我们在评论中讨论的那样,解决方案是更新存储该GitHub令牌的auth.json中的条目。

对于寻求该解决方案的每个人-auth.json存储在您的COMPOSER_HOME路径中。您可以通过在控制台中调用找到此路径

composer config -g data-dir

有关Composer配置的更多信息,请参阅Composer documentation at getcomposer.org