欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-03-26 07:52:15
...
最近在学习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出错问题总结的详细内容,更多请关注其它相关文章!