Composer [UnexpectedValueException] 错误将尝试使用 composer 安装一个 github 项目 [英] Composer [UnexpectedValueException] error will trying to use composer to install a github project
问题描述
我正在尝试使用 composer 安装一个 github 项目并得到以下错误
I am trying to install a github project using composer and get the following error
作曲家 [UnexpectedValueException]您的 github.com 的 Github oauth 令牌包含无效字符:"
Composer [UnexpectedValueException] Your Github oauth token for github.com contains invalid characters: ""
谁能解释我需要做什么来纠正这个错误?
Can anyone explain what I need to do to correct this error?
我正在使用以下命令
composer create-project --prefer-dist --stability=dev vova07/yii2-start yii2-start
composer create-project --prefer-dist --stability=dev vova07/yii2-start yii2-start
谢谢
推荐答案
我开始遇到类似的错误,原因是 Github 最近更改了他们的身份验证令牌的格式:
I started getting a similar error and the reason was that Github recently changed the format of their auth tokens:
解决错误:
- 找到
composer/auth.json
文件(如果您在容器中运行项目,则必须 bash 并在其中找到文件) - 删除其
github.com
条目.删除条目后,您的文件可能如下所示:{"github-oauth": {}}
- 运行
composer 自我更新
.该问题在版本2.0.12
中得到解决.在此处查看该版本更改日志中的第一项:https://getcomposer.org/changelog/2.0.12
- Find the
composer/auth.json
file (if you're running the project in a container, you'll have to bash into it and find the file in there) - Remove its
github.com
entry. Your file will probably look like the following after removing the entry:{"github-oauth": {}}
- Run
composer self-update
. The issue got resolved in version2.0.12
. See the first item in the changelog for that version here: https://getcomposer.org/changelog/2.0.12
之后,您可以将 composer/auth.json
文件恢复到其初始状态,因为较新版本的 composer 将识别新的密钥格式.
After that, you can restore your composer/auth.json
file to its initial state as the newer version of composer will recognize the new key format.
这篇关于Composer [UnexpectedValueException] 错误将尝试使用 composer 安装一个 github 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!