当前位置:Gxlcms > PHP教程 > yii2使用安装composer出错问题总结

yii2使用安装composer出错问题总结

时间:2021-07-01 10:21:17 帮助过:43人阅读

最近在学习yii2.0 一直想用官方推荐的composer来安装 一直不成功 报了一个错误一直在困扰着我

废话少说 直入主题

终端所报的错误:

➜ Yii2.0 composer create-project yiisoft/yii2-app-advanced yii2-advanced --prefer-dist
Installing yiisoft/yii2-app-advanced (2.0.12)
- Installing yiisoft/yii2-app-advanced (2.0.12): Downloading (100%)
Created project in yii2-advanced
Loading composer repositories with package information
Updating dependencies (including require-dev)


[Composer\Repository\InvalidRepositoryException]
No valid bower.json was found in any branch or tag of , could not load a package from it.

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]

问题描述:

在终端输入

composer create-project yiisoft/yii2-app-advanced yii2-advanced --prefer-dist

之后就出现了这个错误。。。。

解决办法:

目前我发现解决这个问题的办法是:

直接编辑yii2-advanced文件夹composer.json文件

vi yii2-advanced/composer.json

然后添加github的授权

"config": {"process-timeout": 1800},

改为

"config": {"process-timeout": 1800,"github-oauth": {          "github.com": "此处输入您的github授权码"  }
    },

保存文件,运行以下命令即可完成yii2框架的导入

cd yii2-advanced
composer update

如何获取github的授权码??

点击此链接 --> 点击右上角Generate new token --> 在Token description中输入"yii composer install token"

--> 点击Generate token即可创建新的github授权码

Token description中可以随意输入描述

以上就是yii2使用安装composer出错问题总结的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行