在 docker 下安装 composer-plugin-api 时出错

I got errors installing composer-plugin-api under docker(在 docker 下安装 composer-plugin-api 时出错)
本文介绍了在 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 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)