在 docker 下安装 composer-plugin-api 时出错 [英] I got errors installing composer-plugin-api under docker

查看:18
本文介绍了在 docker 下安装 composer-plugin-api 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

In laravel 6 project under docker I switched to one of branches and made git pull for updates made by other developer But I got errors by running composer update :

    - joshbrw/laravel-module-installer v1.0.1 requires composer-plugin-api ^2.0 -> no matching package found.
    - joshbrw/laravel-module-installer v1.0.1 requires composer-plugin-api ^2.0 -> no matching package found.
    - joshbrw/laravel-module-installer v1.0.0 requires composer-plugin-api ^2.0 -> no matching package found.
    - Installation request for joshbrw/laravel-module-installer ^1.0 -> satisfiable by joshbrw/laravel-module-installer[v1.0.0, v1.0.1].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
...

In composer.lock I found

"joshbrw/laravel-module-installer": "^1.0",

and :

"require": {
    "composer-plugin-api": "^2.0",
    "php": "^5.4|7.*"
},

In composer.json I see:

"joshbrw/laravel-module-installer": "^1.0",

  1. I tried to install composer-plugin-api. But I am not sure was it a correct decision ?

    root@f32a029eae89:/app# composer require composer-plugin-api Using version ^1.1 for composer-plugin-api ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 134217736 bytes) in phar:///usr/bin/composer/src/Composer/DependencyResolver/RuleSet.php on line 83

    Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 134217736 bytes) in phar:///usr/bin/composer/src/Composer/DependencyResolver/RuleSet.php on line 83

    Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.

I check memory:

root@f32a029eae89:/app# php -r "echo ini_get('memory_limit').PHP_EOL;"
1024M
root@f32a029eae89:/app# free
              total        used        free      shared  buff/cache   available
Mem:        8085248     5249464     1238412      159684     1597372     2372452
Swap:       2104476      905984     1198492

  1. Which is valid format for composer require package command with big value of memmory ?

I check composer in docker console :

root@f32a029eae89:/app# composer --version
Composer version 1.10.13 2020-09-09 11:46:34

解决方案

joshbrw/laravel-module-installer v1.0.1 requires composer-plugin-api ^2.0 -> no matching package found.

You need composer 2 to install that package, and you are using composer 1.

If you are using the Composer docker image, you just need to add:

FROM composer:2 as composer

to the appropriate dockerfile. If you are downloading it manually, please make sure you download the appropriate version.

这篇关于在 docker 下安装 composer-plugin-api 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆