解决使用composer出现的错误

解决使用composer出现的错误

第一次使用composer ,因为yii项目必须要用到,然而·····
composer install / update 会报如下错误:

F:\xxx\www\yii_blog>composer install
You are running composer with xdebug enabled. This has a major impact on runtime performance. 
See https: //getcomposer.org/xdebug
Loading composer repositories with package informationInstalling dependencies (including require-dev) from lock file Warning: The lock file is not up to date with the latest changes in composer.jso n .
You may be getting outdated dependencies.
Run update to update them.Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for fxp/composer-asset- plugin v1.0.0-beta4 -> satisfiable by fxp/composer-asset- plugin [v1.0.0-beta4]. - fxp/composer-asset- plugin v1.0.0-beta4 requires composer- plugin -api 1.0.0-> no matching package found.

Problem 2
- Installation request for yiisoft/yii2-composer 2.0.3 -> satisfiable by yiisoft/yii2-composer[2.0.3].
- yiisoft/yii2-composer 2.0.3 requires composer- plugin -api 1.0.0 -> no match ing package found.

Problem 3
- yiisoft/yii2-composer 2.0.3 requires composer- plugin -api 1.0.0 -> no match ing package found.
- yiisoft/yii2 2.0.3 requires yiisoft/yii2-composer * -> satisfiable by yiisoft/yii2-composer[2.0.3].
- Installation request for yiisoft/yii2 2.0.3 -> satisfiable by yiisoft/yii2[2.0.3].Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your min imum-stability setting
see <https: //getcomposer.org/doc/04-schema.md#minimum-stability> for more det ails.
Read <https: //getcomposer.org/doc/articles/troubleshooting.md> for further commo n problems.

```````````````````````````````````````````````````````````````````````````````````````````````````````````
 

经过了一番的几小时的摸索,于是我开始了我的报错解决之道:

step0:
安装composer:
要么 ①下载composer.phar 要么②安装composer install.exe for windows

step1:
Yii2 需要  composer-plugin-api 1.0  以上的版本
檢查  composer-asset-plugin  的版本或者查看一下有無安裝, 先確定有沒有或者有沒有超過1.0以上
如果都沒有的話使用  composer global require "fxp/composer-asset-plugin:~1.1.1"  去下載,

 
[http://www.yiichina.com/topic/6216]

step3:
启用Packagist镜像
系统全局配置: 即将配置信息添加到 Composer 的全局配置文件 config.json 中。
composer config -g repo.packagist composer https://packagist.phpcomposer.com

[http://pkg.phpcomposer.com/] 

step4:
安装fxp/composer-asset-plugin
: composer require fxp/composer-asset-plugin
这时候中间会提示需要输入一个token:
 
并且:记住命令行要求github的token:

 所以去github:

 得到token后,复制过来

 等待安装 fxp/composer-asset-plugin

完成后是这样的:
 

[https://packagist.org/packages/fxp/composer-asset-plugin ]





  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
在重新安装 Composer 过程中,可能会遇到以下常见错误: 1. "Could not open input file: composer.phar" - 这个错误通常是由于在命令中使用错误的文件路径,或者没有在命令中指定正确的 Composer 文件名。确保你在命令中正确地指定了 Composer 文件的位置和名称。 2. "The following exception is caused by a lack of memory or swap, or not having swap configured" - 这个错误通常是由于你的服务器上没有足够的内存或交换空间来运行 Composer。你可以尝试增加服务器的内存或交换空间,或者在运行 Composer 命令时使用 --prefer-dist 标志来减少内存使用。 3. "Installation failed, reverting ./composer.json to its original content." - 这个错误通常是由于 Composer 在安装依赖项时遇到了错误。你可以查看 Composer 的输出信息来查找出错的原因,并尝试重新运行安装命令。 4. "Composer detected issues in your platform: Your Composer dependencies require a PHP version " - 这个错误通常是由于你的 PHP 版本不符合 Composer 依赖项的要求。你可以尝试升级 PHP 版本,或者在运行 Composer 命令时使用 --ignore-platform-reqs 标志来忽略版本要求。 5. "The requested PHP extension ext-xxx * is missing from your system." - 这个错误通常是由于你的系统缺少必需的 PHP 扩展,需要手动安装扩展或启用扩展。你可以通过搜索相关的扩展以及安装方法来解决问题。 希望这些信息对你有所帮助!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值