新鲜的laravel / homestead规定中使用GitHub OAuth令牌的编译器错误

时间:2015-08-01 21:45:38

标签: github laravel-5 composer-php homestead

根据文档,全新安装laravel/homestead流浪者框,运行init.sh,配置Homestead.yaml并运行$ vagrant up; vagrant ssh。之后cd已编辑到项目的文件夹并运行composer install

它挂起等待token并带有以下消息

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing sebastian/diff (1.3.0)
Downloading: Connecting...
Could not fetch https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+homestead+2015-08-01+2140
to retrieve a token. It will be stored in "/home/vagrant/.composer/auth.json" for future use by Composer.
Token (hidden):

我之前使用过laravel/homestead,我从来没有做过这些,这是一些未记录的新功能或错误,还是我做错了什么?

3 个答案:

答案 0 :(得分:31)

如果您还没有GitHub帐户,则需要创建一个GitHub帐户,然后按照here说明操作,然后复制该令牌。

获得令牌后,再次运行composer install,然后在提示时将其粘贴到其中。

答案 1 :(得分:2)

错误表示您已超出IP地址的API速率限制。

你可以:

  • 等一下,再试一次,
  • 更改您的IP地址(例如,通过代理或VPN连接),
  • 按照消息的建议指定您的身份验证令牌:

      

    请创建一个GitHub OAuth令牌来检查API速率限制   前往https://github.com/settings/tokens/new?scopes=repo

    并传入您的Composer命令或手动将其添加到~/.composer/auth.json,例如

    {
        "http-basic": {},
        "github-oauth": {
            "github.com": "__TOKEN__"}
    }
    

    注意:在Windows上,它位于%APPDATA%/Composer

    或通过以下命令手动添加设置(根据此comment):

    composer config -g --unset github-oauth.api.github.com
    composer config -g github-oauth.github.com __TOKEN__
    

答案 2 :(得分:0)

转到设置,然后从个人访问令牌中选择开发人员设置,即可生成新令牌

enter image description here