Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
452 views
in Technique[技术] by (71.8m points)

php - I got errors installing composer-plugin-api under docker

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...